fixed potential crash if local file path does not point to valid image file URL