sfx2/source/doc/docfile.cxx    |    3 ++-
 sfx2/source/doc/objmisc.cxx    |    2 +-
 tools/source/stream/stream.cxx |    2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

New commits:
commit b4fda935deaec67ccadf937d6a9604e60e0f51ea
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Dec 10 11:57:35 2023 +0300
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sun Dec 10 12:38:17 2023 +0100

    Keep original error
    
    Fix several SetError implementations, to make sure that original
    errors are not rewritten, but OTOH warnings could be replaced by
    errors.
    
    Change-Id: Ic5e71b791ff3426ff1144778a610ab77fcbf24d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160530
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 411c980b6e09..319615bacd20 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -508,7 +508,8 @@ ErrCodeMsg const & SfxMedium::GetLastStorageCreationState() 
const
 
 void SfxMedium::SetError(ErrCodeMsg nError)
 {
-    pImpl->m_eError = nError;
+    if (pImpl->m_eError == ERRCODE_NONE || (pImpl->m_eError.IsWarning() && 
nError.IsError()))
+        pImpl->m_eError = nError;
 }
 
 void SfxMedium::SetWarningError(const ErrCodeMsg& nWarningError)
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 5b7aa98df38e..08a8ec0797b8 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -215,7 +215,7 @@ std::vector<InfobarData>& 
SfxObjectShell::getPendingInfobars()
 
 void SfxObjectShell::SetError(const ErrCodeMsg& lErr)
 {
-    if (pImpl->lErr==ERRCODE_NONE)
+    if (pImpl->lErr == ERRCODE_NONE || (pImpl->lErr.IsWarning() && 
lErr.IsError()))
     {
         pImpl->lErr=lErr;
     }
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index 6318348de5ec..f5ddabac548d 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -355,7 +355,7 @@ void SvStream::ClearError()
 
 void SvStream::SetError( ErrCode nErrorCode )
 {
-    if (m_nError == ERRCODE_NONE)
+    if (m_nError == ERRCODE_NONE || (m_nError.IsWarning() && 
nErrorCode.IsError()))
         m_nError = nErrorCode;
 }
 

Reply via email to