diff options
| author | Lucian Copeland <hierophect@gmail.com> | 2020-09-10 15:37:43 -0400 |
|---|---|---|
| committer | Lucian Copeland <hierophect@gmail.com> | 2020-09-10 15:37:43 -0400 |
| commit | f95ad7b27c040e54daeb4c71d6bb6c35844be66e (patch) | |
| tree | bd233e89ca737ef2689454fd814f324da3e9f322 /shared-module | |
| parent | be199983c155118717b56a405e546b3bb79c49ea (diff) | |
Fix reset pin null reference, construct error null reference
Diffstat (limited to 'shared-module')
| -rw-r--r-- | shared-module/displayio/FourWire.c | 4 | ||||
| -rw-r--r-- | shared-module/displayio/I2CDisplay.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/shared-module/displayio/FourWire.c b/shared-module/displayio/FourWire.c index 17e8cfa1d..726116208 100644 --- a/shared-module/displayio/FourWire.c +++ b/shared-module/displayio/FourWire.c @@ -76,7 +76,9 @@ void common_hal_displayio_fourwire_deinit(displayio_fourwire_obj_t* self) { common_hal_reset_pin(self->command.pin); common_hal_reset_pin(self->chip_select.pin); - common_hal_reset_pin(self->reset.pin); + if (self->reset.pin) { + common_hal_reset_pin(self->reset.pin); + } } bool common_hal_displayio_fourwire_reset(mp_obj_t obj) { diff --git a/shared-module/displayio/I2CDisplay.c b/shared-module/displayio/I2CDisplay.c index 0c8f2e69a..9e9e17881 100644 --- a/shared-module/displayio/I2CDisplay.c +++ b/shared-module/displayio/I2CDisplay.c @@ -53,6 +53,7 @@ void common_hal_displayio_i2cdisplay_construct(displayio_i2cdisplay_obj_t* self, // Probe the bus to see if a device acknowledges the given address. if (!common_hal_busio_i2c_probe(i2c, device_address)) { + self->base.type = &mp_type_NoneType; mp_raise_ValueError_varg(translate("Unable to find I2C Display at %x"), device_address); } @@ -71,7 +72,9 @@ void common_hal_displayio_i2cdisplay_deinit(displayio_i2cdisplay_obj_t* self) { common_hal_busio_i2c_deinit(self->bus); } - common_hal_reset_pin(self->reset.pin); + if (self->reset.pin) { + common_hal_reset_pin(self->reset.pin); + } } bool common_hal_displayio_i2cdisplay_reset(mp_obj_t obj) { |
