make sure None is returned in no-such-card case

This commit is contained in:
Damien Elmes 2020-04-02 11:29:40 +10:00
parent 70a1992f70
commit 431683aa5d

View File

@ -485,7 +485,11 @@ class RustBackend:
).search_notes.note_ids
def get_card(self, cid: int) -> Optional[pb.Card]:
return self._run_command(pb.BackendInput(get_card=cid)).get_card.card
output = self._run_command(pb.BackendInput(get_card=cid)).get_card
if output.HasField("card"):
return output.card
else:
return None
def update_card(self, card: BackendCard) -> None:
self._run_command(pb.BackendInput(update_card=card))