vcl/source/window/dialog.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit ae4b61024f460af3c38eac24539f16c934698ff6
Author:     Szymon Kłos <[email protected]>
AuthorDate: Mon Nov 29 08:30:39 2021 +0100
Commit:     Andras Timar <[email protected]>
CommitDate: Thu Dec 9 13:22:17 2021 +0100

    Warn instead of crash when mpDialogImpl is missing
    
    In LOK case we have some issues with dialogs to solve.
    Try to not crash in release but warn.
    
    Change-Id: Ic966d2b317a4e454d1d164ae36a96327c435ae6b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126020
    Reviewed-by: Michael Meeks <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 74462fc1c7c5..54d12e8945db 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -1067,10 +1067,20 @@ short Dialog::Execute()
         OSL_FAIL( "Dialog::Execute() - Dialog destroyed in Execute()" );
     }
 
-    tools::Long nRet = mpDialogImpl->mnResult;
-    mpDialogImpl->mnResult = -1;
+    assert(mpDialogImpl);
 
-    return static_cast<short>(nRet);
+    if (mpDialogImpl)
+    {
+        tools::Long nRet = mpDialogImpl->mnResult;
+        mpDialogImpl->mnResult = -1;
+
+        return static_cast<short>(nRet);
+    }
+    else
+    {
+        SAL_WARN( "vcl", "Dialog::Execute() : missing mpDialogImpl " );
+        return 0;
+    }
 }
 
 // virtual

Reply via email to