Skip to content

Commit

Permalink
NPE Error When Leaving the SPARQL View
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
boyan-tonchev committed Feb 1, 2024
1 parent 49a7252 commit 3ed080b
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
};

/**
Expand Down

0 comments on commit 3ed080b

Please sign in to comment.