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
+5 -1
View File
@@ -50,7 +50,11 @@ export class Module extends Serializable<Module> {
return { return {
id: this.id, id: this.id,
pointerRole: PointerRole[this.pointerRole], pointerRole: PointerRole[this.pointerRole],
keyActions: this.keyActions.map(keyAction => keyAction.toJsObject()) keyActions: this.keyActions.map(keyAction => {
if (keyAction) {
return keyAction.toJsObject();
}
})
}; };
} }
@@ -66,6 +66,10 @@ export class Helper {
} }
private static fromJSONObject(keyAction: any): KeyAction { private static fromJSONObject(keyAction: any): KeyAction {
if (!keyAction) {
return;
}
switch (keyAction.keyActionType) { switch (keyAction.keyActionType) {
case keyActionType.NoneAction: case keyActionType.NoneAction:
return new NoneAction().fromJsObject(keyAction); return new NoneAction().fromJsObject(keyAction);