changeset 317:a185aff39051

Fixes crashes when attempting to draw/move when no layers are active
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 15 Aug 2009 18:10:51 +0000
parents 6add14ebe9f5
children e2ac8bb1a22c
files clients/editor/scripts/gui/mapeditor.py
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/clients/editor/scripts/gui/mapeditor.py	Sat Aug 15 00:42:23 2009 +0000
+++ b/clients/editor/scripts/gui/mapeditor.py	Sat Aug 15 18:10:51 2009 +0000
@@ -252,6 +252,10 @@
 	def mousePressed(self, sender, event):
 		if event.isConsumedByWidgets():
 			return
+			
+		if not self._controller._layer:
+			if self._controller.debug: print 'No layers active. Cancelling map action'
+			return
 
 		realCoords = self._getRealCoords(sender, event)
 
@@ -330,6 +334,10 @@
 		if event.isConsumedByWidgets():
 			return
 			
+		if not self._controller._layer:
+			if self._controller.debug: print 'No layers active. Cancelling map action'
+			return
+			
 		realCoords = self._getRealCoords(sender, event)
 			
 		if event.getButton() == fife.MouseEvent.MIDDLE:
@@ -384,6 +392,10 @@
 		if event.isConsumedByWidgets():
 			return
 			
+		if not self._controller._layer:
+			if self._controller.debug: print 'No layers active. Cancelling map action'
+			return
+			
 		if self._mode == SELECTING or self._mode == MOVING:
 			instances = self._controller.getInstancesFromSelection()
 			if len(instances) > 0: