diff options
author | Kelvin Sherlock <ksherlock@gmail.com> | 2020-09-27 11:20:58 -0400 |
---|---|---|
committer | Kelvin Sherlock <ksherlock@gmail.com> | 2020-09-27 11:22:22 -0400 |
commit | fcacca9a41757e020d9870489b1a25190b2fb50f (patch) | |
tree | bd2992627f930e475eb84c8602e2957cd9fe8cc9 | |
parent | 81c484197b85d72717f310b1a828fb44016a6382 (diff) |
picture_image_device::get_bitmap was returning a possibly-null reference
null references are not valid/undefined in C++ so compilers like to
eliminate the null pointer check.
switched to returning a pointer instead.
-rw-r--r-- | src/devices/bus/a2bus/computereyes2.cpp | 2 | ||||
-rw-r--r-- | src/devices/bus/a2gameio/computereyes.cpp | 2 | ||||
-rw-r--r-- | src/devices/imagedev/picture.h | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/devices/bus/a2bus/computereyes2.cpp b/src/devices/bus/a2bus/computereyes2.cpp index b8a80819023..4247f2f38df 100644 --- a/src/devices/bus/a2bus/computereyes2.cpp +++ b/src/devices/bus/a2bus/computereyes2.cpp @@ -196,7 +196,7 @@ void a2bus_computereyes2_device::write_c0nx(uint8_t offset, uint8_t data) m_x = m_y = 0; std::fill_n(m_a2_bitmap, 280*193, 0); - m_bitmap = &m_picture->get_bitmap(); + m_bitmap = m_picture->get_bitmap(); if (m_bitmap) { // convert arbitrary sized ARGB32 image to a 188x193 image with 256 levels of grayscale diff --git a/src/devices/bus/a2gameio/computereyes.cpp b/src/devices/bus/a2gameio/computereyes.cpp index 1c587f54254..799564de0a6 100644 --- a/src/devices/bus/a2gameio/computereyes.cpp +++ b/src/devices/bus/a2gameio/computereyes.cpp @@ -82,7 +82,7 @@ WRITE_LINE_MEMBER(apple2_compeyes_device::an0_w) std::fill_n(m_a2_bitmap, 280*192, 0); - m_bitmap = &m_picture->get_bitmap(); + m_bitmap = m_picture->get_bitmap(); if (m_bitmap) { // convert arbitrary sized ARGB32 image to a 280x192 image with 256 levels of grayscale diff --git a/src/devices/imagedev/picture.h b/src/devices/imagedev/picture.h index f8601345a89..60f0eb8224a 100644 --- a/src/devices/imagedev/picture.h +++ b/src/devices/imagedev/picture.h @@ -41,7 +41,7 @@ public: virtual bool is_reset_on_load() const noexcept override { return false; } virtual const char *file_extensions() const noexcept override { return "png"; } - bitmap_argb32 &get_bitmap() { return *m_picture; } + bitmap_argb32 *get_bitmap() { return m_picture; } protected: // device-level overrides |