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);
|
var fn :Function = (this["handle" + cmd] as Function);
|
||||||
if (fn != null) {
|
if (fn != null) {
|
||||||
try {
|
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) {
|
} catch (e :Error) {
|
||||||
var log :Log = Log.getLog(this);
|
var log :Log = Log.getLog(this);
|
||||||
log.warning("Error handling controller " +
|
log.warning("Error handling controller " +
|
||||||
|
|||||||
Reference in New Issue
Block a user