Browse Source

Fix a small error with addElement

Edgardo Palza 8 years ago
parent
commit
105bbd649c
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/ui/view/GUI.java

+ 6 - 4
src/ui/view/GUI.java

@@ -291,10 +291,12 @@ public class GUI implements CategoryListener {
 		toolBarHolonEl.add(btnDelHolEL);
 		btnDelHolEL.addActionListener(new ActionListener() {
 			public void actionPerformed(ActionEvent arg0) {
-				HolonObject obj = (HolonObject) getActualCps();
-				tempElement = getActualHolonElement(obj, yValueElements);
-				if (tempElement != null && obj.getClass() == HolonObject.class && obj.getID() != 0) {
-					controller.deleteElementCanvas(obj.getID(), tempElement.getEleName());
+				if (getActualCps().getClass() == HolonObject.class) {
+					HolonObject obj = (HolonObject) getActualCps();
+					tempElement = getActualHolonElement(obj, yValueElements);
+					if (tempElement != null && obj.getClass() == HolonObject.class && obj.getID() != 0) {
+						controller.deleteElementCanvas(obj.getID(), tempElement.getEleName());
+					}
 				}
 			}
 		});