You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2020/02/07 11:23:40 UTC

[myfaces-tobago] 01/02: no NPE for missing elements

This is an automated email from the ASF dual-hosted git repository.

lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git

commit 78c8a1881d53f5eaf75de373a444fc217d1197df
Author: Udo Schnurpfeil <ud...@irian.eu>
AuthorDate: Thu Feb 6 13:00:53 2020 +0100

    no NPE for missing elements
    
    issue: TOBAGO-1633
---
 .../tobago-theme-standard/src/main/npm/ts/tobago-command.ts        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
index a1daddb..af1275e 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
@@ -52,7 +52,12 @@ class Behavior extends HTMLElement {
         // prepare overlay for all by AJAX reloaded elements
         let partialIds = this.render.split(" ");
         for (let i = 0; i < partialIds.length; i++) {
-          new Overlay(document.getElementById(partialIds[i]), true);
+          const partialElement = document.getElementById(partialIds[i]);
+          if (partialElement) {
+            new Overlay(partialElement, true);
+          } else {
+            console.warn("No element found by id='%s' for overlay!", partialIds[i]);
+          }
         }
       }
       jsf.ajax.request(