From 3ed080b1f4aadf929338462a79e729e87508e76e Mon Sep 17 00:00:00 2001 From: "boyan.tonchev" Date: Thu, 1 Feb 2024 10:46:43 +0200 Subject: [PATCH] NPE Error When Leaving the SPARQL View What Sometimes, an error occurs with the message 'Cannot read properties of undefined (reading 'getOntotextYasguiElement')'. Why In the 'getOntotextYasguiElement' function, we attempt to fetch the 'ontotext-yasgui-web-component' regardless of whether it is present or not. How Added a check to verify if the element is present before attempting to fetch it. --- .../yasgui-component/yasgui-component-directive.util.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/angular/core/directives/yasgui-component/yasgui-component-directive.util.js b/src/js/angular/core/directives/yasgui-component/yasgui-component-directive.util.js index 0d9f8c9fb..2217c0d7a 100644 --- a/src/js/angular/core/directives/yasgui-component/yasgui-component-directive.util.js +++ b/src/js/angular/core/directives/yasgui-component/yasgui-component-directive.util.js @@ -26,7 +26,10 @@ export const YasguiComponentDirectiveUtil = (function () { * @return {YasguiComponent} */ const getOntotextYasguiElement = (directiveSelector) => { - return YasguiComponentDirectiveUtil.getOntotextYasguiElementController(directiveSelector).getOntotextYasguiElement(); + const ontotextYasguiElementController = YasguiComponentDirectiveUtil.getOntotextYasguiElementController(directiveSelector); + if (ontotextYasguiElementController) { + return ontotextYasguiElementController.getOntotextYasguiElement(); + } }; /**