This is an automated email from the ASF dual-hosted git repository.

neilcsmith pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 72a315a  [NETBEANS-3095] avoid null pointer exception in SplashPainter 
(#1496)
72a315a is described below

commit 72a315aae7061538e7481228b67189637c1a1b6a
Author: oyarzun <[email protected]>
AuthorDate: Wed Sep 18 08:22:16 2019 -0700

    [NETBEANS-3095] avoid null pointer exception in SplashPainter (#1496)
    
    * [NETBEANS-3095] avoid null pointer exception in SplashPainter
    
    * [NETBEANS-3095] add braces around if statements. add missing whitespace.
    
    * [NETBEANS-3095] check that loadContentIcon did not return a null image.
    
    * Move statusBox null check to init method
---
 .../src/org/netbeans/core/startup/Splash.java        | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/platform/core.startup/src/org/netbeans/core/startup/Splash.java 
b/platform/core.startup/src/org/netbeans/core/startup/Splash.java
index 9c9e00a..c9985ca 100644
--- a/platform/core.startup/src/org/netbeans/core/startup/Splash.java
+++ b/platform/core.startup/src/org/netbeans/core/startup/Splash.java
@@ -244,10 +244,12 @@ public final class Splash implements Stamps.Updater {
         if (about) {
             ret = 
ImageUtilities.loadImage("org/netbeans/core/startup/about.png", true);
         }
-        if (ret == null)
+        if (ret == null) {
             ret = 
ImageUtilities.loadImage("org/netbeans/core/startup/splash.gif", true);
-        if (ret == null)
+        }
+        if (ret == null) {
             return null;
+        }
         return new ScaledBitmapIcon(ret,
                 Integer.parseInt(NbBundle.getMessage(Splash.class, 
"SPLASH_WIDTH")),
                 Integer.parseInt(NbBundle.getMessage(Splash.class, 
"SPLASH_HEIGHT")));
@@ -437,7 +439,8 @@ public final class Splash implements Stamps.Updater {
 
         final void init() throws MissingResourceException, 
NumberFormatException {
             assert SwingUtilities.isEventDispatchThread();
-            if (maxSteps > 0) {
+            // check if init has already been called
+            if (statusBox != null) {
                 return;
             }
             // 100 is allocated for module system that will adjust this when 
number
@@ -541,11 +544,13 @@ public final class Splash implements Stamps.Updater {
             String newText = null;
             String newString;
             
-            if (text == null)
+            if (text == null) {
                 return ;
+            }
 
-            if (statusBox.fm == null)
+            if (statusBox.fm == null) {           
                 return;
+            }
             
             int width = statusBox.fm.stringWidth(text);
             
@@ -633,7 +638,10 @@ public final class Splash implements Stamps.Updater {
         }
        
         void paint() {
-            image.paintIcon(comp, graphics, 0, 0);
+            // loadContentIcon may return a null image
+            if (image != null) {
+                image.paintIcon(comp, graphics, 0, 0);
+            }
             // turn anti-aliasing on for the splash text
             graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                     RenderingHints.VALUE_TEXT_ANTIALIAS_ON);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to