fix null pointer exception in getMaxImageSize