Fixed null problem (#162)

Closes #157
This commit is contained in:
Nejc Zdovc
2016-11-20 13:38:24 +01:00
committed by József Farkas
parent ac499d21f7
commit 768db3d757
2 changed files with 9 additions and 1 deletions

View File

@@ -50,7 +50,11 @@ export class Module extends Serializable<Module> {
return {
id: this.id,
pointerRole: PointerRole[this.pointerRole],
keyActions: this.keyActions.map(keyAction => keyAction.toJsObject())
keyActions: this.keyActions.map(keyAction => {
if (keyAction) {
return keyAction.toJsObject();
}
})
};
}

View File

@@ -66,6 +66,10 @@ export class Helper {
}
private static fromJSONObject(keyAction: any): KeyAction {
if (!keyAction) {
return;
}
switch (keyAction.keyActionType) {
case keyActionType.NoneAction:
return new NoneAction().fromJsObject(keyAction);