[WRTjs] Check window when emit related event 26/268326/3
authorliwei <wei90727.li@samsung.com>
Mon, 20 Dec 2021 10:57:32 +0000 (18:57 +0800)
committerliwei <wei90727.li@samsung.com>
Thu, 23 Dec 2021 03:59:34 +0000 (11:59 +0800)
For Epop, if miss any configuration in TV, the app will
terminate itself quickly, then 'quit->load-finish' will
happen, so check window before emit event to avoid exception.

Change-Id: Ifa1adcc34f2be6a21d605065e1fca189f63f5447
Signed-off-by: liwei <wei90727.li@samsung.com>
wrt_app/src/web_application.ts

index 640b49c5128b54a86c0efa568db718d62b481f80..b1b33b88d14efb914b261ef440eac27a1a97d716 100644 (file)
@@ -226,8 +226,11 @@ export class WebApplication {
     });
 
     this.mainWindow.webContents.on('did-finish-load', () => {
-      console.log('webContents did-finish-load');
+      console.log(`webContents did-finish-load, window length is ${this.windowList.length}`);
       this.loadFinished = true;
+
+      if (!this.windowList.length)
+        return;
       if (this.splashShown)
         this.hideSplashScreen('complete');