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

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git


The following commit(s) were added to refs/heads/master by this push:
     new 7426394f protect against one possible NPE error in dsl editor
7426394f is described below

commit 7426394f6c25133db01b3e4cd1ed4b75b106ed0d
Author: Alex Heneveld <[email protected]>
AuthorDate: Fri Dec 16 09:13:31 2022 +0000

    protect against one possible NPE error in dsl editor
---
 .../blueprint-composer/app/components/dsl-editor/dsl-editor.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git 
a/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js 
b/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js
index 2a507819..feabd1bd 100644
--- a/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js
+++ b/ui-modules/blueprint-composer/app/components/dsl-editor/dsl-editor.js
@@ -156,9 +156,13 @@ export function dslEditorDirective($rootScope, $filter, 
$log, brUtilsGeneral, bl
                     return argument.kind === KIND.STRING ? argument.name : 
argument.toString();
                 });
             }
-            let relatedEntity = scope.dsl.getRoot().relationships.find(entity 
=> entity.id === scope.dsl.params[0].name);
-            if (relatedEntity) {
-                scope.state.filter = scope.filters.find(filter => filter.id 
=== relatedEntity._id);
+            try {
+                let relatedEntity = scope.dsl.params.length && 
scope.dsl.getRoot().relationships.find(entity => entity.id === 
scope.dsl.params[0].name);
+                if (relatedEntity) {
+                    scope.state.filter = scope.filters.find(filter => 
filter.id === relatedEntity._id);
+                }
+            } catch (e) {
+                console.log("Error analysing DSL (ignore)", scope.dsl, 
scope.filters, e);
             }
         }
 

Reply via email to