From 8386957cbc4f4856963795ac2c74dc2977e5ac52 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 29 Aug 2006 01:06:06 +0000 Subject: [PATCH] Allow the handleCOMMAND functions to have no arg if the command's arg is null. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4347 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/util/Controller.as | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/as/com/threerings/util/Controller.as b/src/as/com/threerings/util/Controller.as index 25329c258..0d71855bf 100644 --- a/src/as/com/threerings/util/Controller.as +++ b/src/as/com/threerings/util/Controller.as @@ -46,7 +46,18 @@ public class Controller var fn :Function = (this["handle" + cmd] as Function); if (fn != null) { try { - fn(arg); + try { + // try calling it with the arg + fn(arg); + } catch (ae :ArgumentError) { + if (arg == null) { + // try calling it without the arg + fn(); + } else { + throw ae; + } + } + } catch (e :Error) { var log :Log = Log.getLog(this); log.warning("Error handling controller " +