src/java.desktop/share/classes/sun/awt/SunToolkit.java

Print this page

        

@@ -841,16 +841,22 @@
     protected static boolean imageCached(Object key) {
         return imgCache.containsKey(key);
     }
 
     protected static boolean imageExists(String filename) {
+        if (filename == null) {
+            return false;
+        }
         checkPermissions(filename);
         return filename != null && new File(filename).exists();
     }
 
     @SuppressWarnings("try")
     protected static boolean imageExists(URL url) {
+        if (url == null) {
+            return false;
+        }
         checkPermissions(url);
         if (url != null) {
             try (InputStream is = url.openStream()) {
                 return true;
             }catch(IOException e){