tools: ratbagctl.devel: fix exception if the given arguments are wrong
"sudo ./build/ratbagctl.devel profile 2 4" returns an exception with cmd
being unknown.
@@ -45,6 +45,8 @@ def main(argv):
parser.want_keepalive = True
print('export RATBAGCTL_DEVEL="{}"\n'.format(os.environ['RATBAGCTL_DEVEL']))
+ cmd = None
+
try:
cmd = parser.parse(argv)
cmd.func(ratbagd, cmd)
@@ -54,6 +56,8 @@ def main(argv):
signal.pause()
except KeyboardInterrupt:
pass
+ except AttributeError: # in case the parsing failed and cmd is None
+ pass
toolbox.terminate_ratbagd(ratbagd_process)
