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
This commit is contained in:
@@ -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 " +
|
||||
|
||||
Reference in New Issue
Block a user