Skip to content

Commit

Permalink
handle none return case for ppp
Browse files Browse the repository at this point in the history
  • Loading branch information
lacraig2 committed May 10, 2024
1 parent eca1f66 commit 14c4f55
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions panda/python/core/pandare/panda.py
Original file line number Diff line number Diff line change
Expand Up @@ -2984,11 +2984,12 @@ def _run_and_catch(*args, **kwargs): # Run function but if it raises an exceptio
r = fun(*args, **kwargs)
#print(pandatype, type(r)) # XXX Can we use pandatype to determine requried return and assert if incorrect
#assert(isinstance(r, int)), "Invalid return type?"
try:
return self.ffi.cast(return_type, r)
except TypeError:
# consider throwing an exception
return self.ffi.cast(return_type, 0)
if return_type is not None:
try:
return self.ffi.cast(return_type, r)
except TypeError:
# consider throwing an exception
return self.ffi.cast(return_type, 0)
except Exception as e:
# exceptions wont work in our thread. Therefore we print it here and then throw it after the
# machine exits.
Expand Down

0 comments on commit 14c4f55

Please sign in to comment.