svn commit: r14836 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: mvw
Date: 2008-05-29 11:54:32-0700
New Revision: 14836

Modified:
   trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java

Log:
Fix some NullPointerExceptions I got when testing the Enumeration.

Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java?view=diff&rev=14836&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java&r1=14835&r2=14836
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java	(original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java	2008-05-29 11:54:32-0700
@@ -123,7 +123,10 @@
             if (f instanceof CompartmentFigText) {
                 if (highlightedFigText != null && highlightedFigText != f) {
                     highlightedFigText.setHighlighted(false);
-                    highlightedFigText.getGroup().damage();
+                    if (highlightedFigText.getGroup() != null) {
+                        /* Preventing NullPointerException. */
+                        highlightedFigText.getGroup().damage();
+                    }
                 }
                 ((CompartmentFigText) f).setHighlighted(true);
                 highlightedFigText = (CompartmentFigText) f;
@@ -132,14 +135,6 @@
         }
     }
 
-//    /*
-//     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
-//     */
-//    public void mouseExited(MouseEvent me) {
-//        super.mouseExited(me);
-//        unhighlight();
-//    }
-
     /**
      * Remove the highlight from the currently highlit FigText.
      *
@@ -198,7 +193,10 @@
             if (fig != null && fig instanceof CompartmentFigText) {
                 if (highlightedFigText != null) {
                     highlightedFigText.setHighlighted(false);
-                    highlightedFigText.getGroup().damage();
+                    if (highlightedFigText.getGroup() != null) {
+                        /* Preventing NullPointerException. */
+                        highlightedFigText.getGroup().damage();
+                    }
                 }
                 CompartmentFigText ft = (CompartmentFigText) fig;
                 ft.startTextEditor(ie);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.