https://issues.apache.org/bugzilla/show_bug.cgi?id=44704

           Summary: Potential null pointer dereference in Main
           Product: Batik
           Version: 1.7
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: SVG Viewer
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Starting at line 299 in org.apache.batik.apps.svgbrowser.Main() is the
following code:

                            JSVGViewerFrame relativeTo =
                                viewerFrames.isEmpty()
                                    ?  null
                                    : (JSVGViewerFrame) viewerFrames.get(0);
                            AboutDialog dlg = new AboutDialog(relativeTo);
                            // Work around pack() bug on some platforms
                            dlg.setSize(dlg.getPreferredSize());
                            dlg.setLocationRelativeTo(relativeTo);

relativeTo may be set to null.  This will later get passed do
setLocationRelativeTo().  In AboutDlg's overridden version of this method the
parameter is unconditionally dereferenced, which could cause a null pointer
exception.

AboutDlg.setLocationRelativeTo() should probably be changed to accept a null
value to maintain the contract set by AboutDlg's parent JWindow.


This was detected by FindBugs.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to