Handle potential NPEs in LoadImage

Change-Id: I936b11cde2c1aa38ccc991cc3f6a1eba19147c3f