dbus: fix timeout error if the index is invalid
If the index is not valid, a python exception was raised, and the dbus message was left without and answer. Coincidentally, this matches the documentation
This commit is contained in:
parent
1b73de68b2
commit
f6d09d7086
|
@ -159,7 +159,12 @@ class TuhiDBusDevice(GObject.Object):
|
|||
|
||||
def _json_data(self, args):
|
||||
index = args[0]
|
||||
return self.drawings[index].json()
|
||||
try:
|
||||
drawing = self.drawings[index]
|
||||
except IndexError:
|
||||
return ''
|
||||
else:
|
||||
return drawing.json()
|
||||
|
||||
def add_drawing(self, drawing):
|
||||
self.drawings.append(drawing)
|
||||
|
|
Loading…
Reference in New Issue