diff --git a/web/source/keyboards/kmwkeyboards.ts b/web/source/keyboards/kmwkeyboards.ts index 5ac0622d51..d313ed7153 100644 --- a/web/source/keyboards/kmwkeyboards.ts +++ b/web/source/keyboards/kmwkeyboards.ts @@ -73,7 +73,7 @@ namespace com.keyman.keyboards { /** * Utility to convert stubs to KeyboardStub[] - * @param arg + * @param arg * @returns (KeyboardStub|ErrorStub)[] */ public static toStubs(arg: any): (KeyboardStub|ErrorStub)[] { @@ -962,8 +962,8 @@ namespace com.keyman.keyboards { /** * Returns a Promise of the merged keyboard stubs and error stubs. - * - * If the keyboard stub array is empty, will return a rejected Promise, + * + * If the keyboard stub array is empty, will return a rejected Promise, * otherwise returns a resolved Promise. * * @param keyboardStubs array of keyboard stubs to merge. @@ -1220,14 +1220,16 @@ namespace com.keyman.keyboards { const promiseFuncs = this.registrationResolvers[promiseid]; window.clearTimeout(promiseid); - try { - if(result instanceof Error) { - promiseFuncs.reject(result as Error); - } else { - promiseFuncs.resolve(result as KeyboardStub[]); + if(promiseFuncs) { + try { + if(result instanceof Error) { + promiseFuncs.reject(result as Error); + } else { + promiseFuncs.resolve(result as KeyboardStub[]); + } + } finally { + delete this.registrationResolvers[promiseid]; } - } finally { - delete this.registrationResolvers[promiseid]; } } } @@ -1325,7 +1327,7 @@ namespace com.keyman.keyboards { }).catch(function(error) { return Promise.reject(error); }); - + } else { // Identify and register each keyboard by language name cmd = ''; for(i=0; i