From 17ee28ab6ca24eff15f2f5600ce921c646aa4e95 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sat, 3 Sep 2016 22:52:29 +0200 Subject: [PATCH] Move COMMAND_NESTING safety handler into try..except..finally clause to avoid it ticking up accidentally due to the loop exiting from a traceback. --- evennia/commands/cmdhandler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/evennia/commands/cmdhandler.py b/evennia/commands/cmdhandler.py index 9e35f43ba3..c8a85a024b 100644 --- a/evennia/commands/cmdhandler.py +++ b/evennia/commands/cmdhandler.py @@ -472,7 +472,6 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess caller.ndb.last_cmd = yield copy(cmd) else: caller.ndb.last_cmd = None - _COMMAND_NESTING[called_by] -= 1 # return result to the deferred returnValue(ret) @@ -480,6 +479,9 @@ def cmdhandler(called_by, raw_string, _testing=False, callertype="session", sess except Exception: _msg_err(caller, _ERROR_UNTRAPPED) raise ErrorReported + finally: + _COMMAND_NESTING[called_by] -= 1 + raw_string = to_unicode(raw_string, force_string=True)