Fixed NullPointer if legend image is not available.