diff --git a/src/image/MaskedImage.cc b/src/image/MaskedImage.cc index da2716a5c..d4210a8a3 100644 --- a/src/image/MaskedImage.cc +++ b/src/image/MaskedImage.cc @@ -148,7 +148,8 @@ MaskedImage::MaskedImage( template MaskedImage::MaskedImage(ImagePtr image, MaskPtr mask, VariancePtr variance) - : _image(image), _mask(mask), _variance(variance) { + : _image(image != nullptr ? image : std::make_shared()), + _mask(mask), _variance(variance) { conformSizes(); } diff --git a/tests/test_maskedImage.py b/tests/test_maskedImage.py index a4ccd3cb6..7328c6ccc 100644 --- a/tests/test_maskedImage.py +++ b/tests/test_maskedImage.py @@ -745,6 +745,12 @@ def testTicket653(self): mi = afwImage.MaskedImageF(im) afwImage.ExposureF(mi) + def testTicket41478(self): + """Test for DM-41478 fix""" + masked_image = afwImage.MaskedImageF(None) + image = afwImage.ImageF(None) + self.assertEqual(masked_image.getBBox(), image.getBBox()) + def testMaskedImageInitialisation(self): dims = self.mimage.getDimensions() factory = self.mimage.Factory