mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-03-05 12:57:30 +00:00
python: handle invalid argument (zero) for reg_name() & insn_name() of class CsInsn
This commit is contained in:
parent
1098329f40
commit
1aa60d0921
@ -502,6 +502,9 @@ class CsInsn(object):
|
||||
# Diet engine cannot provide register name
|
||||
raise CsError(CS_ERR_DIET)
|
||||
|
||||
if reg_id == 0:
|
||||
return "(invalid)"
|
||||
|
||||
return _cs.cs_reg_name(self._cs.csh, reg_id).decode('ascii')
|
||||
|
||||
# get the instruction string
|
||||
@ -510,6 +513,9 @@ class CsInsn(object):
|
||||
# Diet engine cannot provide instruction name
|
||||
raise CsError(CS_ERR_DIET)
|
||||
|
||||
if self._raw.id == 0:
|
||||
return "(invalid)"
|
||||
|
||||
return _cs.cs_insn_name(self._cs.csh, self.id).decode('ascii')
|
||||
|
||||
# verify if this insn belong to group with id as @group_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user