dbaccess/source/core/dataaccess/ModelImpl.cxx |   40 ++++++++++++--------------
 sfx2/source/control/bindings.cxx              |    2 -
 2 files changed, 20 insertions(+), 22 deletions(-)

New commits:
commit 75094fbffa3e90b8e32d148f63b6fb9ebd2e3b28
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Feb 23 15:04:53 2026 +0100
Commit:     Samuel Mehrbrodt <[email protected]>
CommitDate: Thu Feb 26 07:46:29 2026 +0100

    Fix DBG_ASSERT logic
    
    cache is only used for non-master commands
    
    This fixes warnings like:
      warn:legacy.tools:1611319:1611319:sfx2/source/control/bindings.cxx:1755: 
No cache for OfficeDispatch!
    
    Change-Id: I9d7583b55481177a15b22317b45316724c0e5e95
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200059
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <[email protected]>

diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index bc72f90f2589..b45d2a093b9e 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1752,7 +1752,7 @@ uno::Reference < frame::XDispatch > 
SfxBindings::GetDispatch( const SfxSlot* pSl
         if ( !pCache )
             pCache = GetStateCache( pSlot->nSlotId );
 
-        DBG_ASSERT( pCache, "No cache for OfficeDispatch!" );
+        DBG_ASSERT( bMasterCommand || pCache, "No cache for OfficeDispatch!" );
         if ( pCache && !bMasterCommand )
             pCache->SetInternalDispatch( xRet );
     }
commit 2a6b0e91fa0990d3098c7b7a705d69da64b8110b
Author:     Samuel Mehrbrodt <[email protected]>
AuthorDate: Mon Feb 23 14:33:02 2026 +0100
Commit:     Samuel Mehrbrodt <[email protected]>
CommitDate: Thu Feb 26 07:46:19 2026 +0100

    Remove unnecessary OSL_ENSURE
    
    All callers handle empty storage references, and this is expected
    when database components are initialized without a backing file.
    
    Fixes warnings like:
      
warn:legacy.osl:1530244:1530244:dbaccess/source/core/dataaccess/ModelImpl.cxx:768:
 ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage 
from!
    
    Change-Id: Ie53b3be6908a2a9b910dd374703237a4aea09794
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200058
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <[email protected]>

diff --git a/dbaccess/source/core/dataaccess/ModelImpl.cxx 
b/dbaccess/source/core/dataaccess/ModelImpl.cxx
index be5c10737131..d7953166f6c5 100644
--- a/dbaccess/source/core/dataaccess/ModelImpl.cxx
+++ b/dbaccess/source/core/dataaccess/ModelImpl.cxx
@@ -765,39 +765,37 @@ Reference< XStorage > const & 
ODatabaseModelImpl::getOrCreateRootStorage()
             aSource <<= m_sDocFileLocation;
         // TODO: shouldn't we also check URL?
 
-        OSL_ENSURE( aSource.hasValue(), 
"ODatabaseModelImpl::getOrCreateRootStorage: no source to create the storage 
from!" );
+        if ( !aSource.hasValue() )
+            return m_xDocumentStorage.getTyped();
 
-        if ( aSource.hasValue() )
-        {
-            Sequence< Any > aStorageCreationArgs{ aSource, 
Any(ElementModes::READWRITE) };
+        Sequence< Any > aStorageCreationArgs{ aSource, 
Any(ElementModes::READWRITE) };
 
-            Reference< XStorage > xDocumentStorage;
-            OUString sURL;
-            aSource >>= sURL;
-            // Don't try to load a meta-URL as-is.
-            if (!sURL.startsWithIgnoreAsciiCase("vnd.sun.star.pkg:"))
+        Reference< XStorage > xDocumentStorage;
+        OUString sURL;
+        aSource >>= sURL;
+        // Don't try to load a meta-URL as-is.
+        if (!sURL.startsWithIgnoreAsciiCase("vnd.sun.star.pkg:"))
+        {
+            try
+            {
+                xDocumentStorage.set( 
xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), 
UNO_QUERY_THROW );
+            }
+            catch( const Exception& )
             {
+                m_bDocumentReadOnly = true;
+                aStorageCreationArgs.getArray()[1] <<= ElementModes::READ;
                 try
                 {
                     xDocumentStorage.set( 
xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), 
UNO_QUERY_THROW );
                 }
                 catch( const Exception& )
                 {
-                    m_bDocumentReadOnly = true;
-                    aStorageCreationArgs.getArray()[1] <<= ElementModes::READ;
-                    try
-                    {
-                        xDocumentStorage.set( 
xStorageFactory->createInstanceWithArguments( aStorageCreationArgs ), 
UNO_QUERY_THROW );
-                    }
-                    catch( const Exception& )
-                    {
-                        DBG_UNHANDLED_EXCEPTION("dbaccess");
-                    }
+                    DBG_UNHANDLED_EXCEPTION("dbaccess");
                 }
             }
-
-            impl_switchToStorage_throw( xDocumentStorage );
         }
+
+        impl_switchToStorage_throw( xDocumentStorage );
     }
     return m_xDocumentStorage.getTyped();
 }

Reply via email to