Fix for #3979 + related NPE fix in ImageManager

git-svn-id: http://dev.geogebra.org/svn/trunk/geogebra@31039 23ce0884-8a58-47d3-bc5c-ddf1cd5b9f9e