Avoiding null assignment and resulting NullPointer exception in Exif saveAttributes()