scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit 4b3308a8c24d71c30145c93411fab12c66660b5e Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Tue Apr 18 15:06:49 2023 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Tue Apr 18 16:31:04 2023 +0200 Avoid NullPointerException ...when dispose is called without a preceding call to initialize (as would happen with an improved CppunitTest_services) Change-Id: Ic632d736ecb27509b092ef526cf0dfc964023663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150576 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java index 078f63395384..dcef62d86077 100644 --- a/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java +++ b/scripting/java/Framework/com/sun/star/script/framework/security/SecurityDialog.java @@ -515,10 +515,12 @@ public class SecurityDialog extends WeakBase implements public void dispose() { - XComponent xComponent = - UnoRuntime.queryInterface(XComponent.class, _xDialog); + if (_xDialog != null) { + XComponent xComponent = + UnoRuntime.queryInterface(XComponent.class, _xDialog); - xComponent.dispose(); + xComponent.dispose(); + } } public void addEventListener(com.sun.star.lang.XEventListener xListener) {