summaryrefslogtreecommitdiff
path: root/chimere/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'chimere/models.py')
-rw-r--r--chimere/models.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/chimere/models.py b/chimere/models.py
index ae1e014..e0b401b 100644
--- a/chimere/models.py
+++ b/chimere/models.py
@@ -356,12 +356,19 @@ class SubCategory(models.Model):
return cats
def getJSONDict(self):
+ # don't crash if some image have disapears
+ try:
+ width = self.icon.image.width
+ height = self.icon.image.height
+ except IOError:
+ width = 0
+ height = 0
items = {'id': self.pk, 'name': self.name,
'description': self.description if self.description
else '',
'icon': {'url': self.icon.image.url,
- 'width': self.icon.image.width,
- 'height': self.icon.image.height,
+ 'width': width,
+ 'height': height,
'offset_x': self.icon.offset_x,
'offset_y': self.icon.offset_y,
'popup_offset_x': self.icon.popup_offset_x,