lo master debug build aborts on OUString NULL check in strtmpl.hxx/newFromStr

Oliver Brinzing Oliver.Brinzing at gmx.de
Sat Aug 13 06:23:27 UTC 2022


Hi,

with lo master debug build:

OUString x;
OUString test = ((x==NULL) || (x.getLenght()==0) ) ? OUString("a") : OUString("b");

will abort lo:

template <typename IMPL_RTL_STRINGDATA>
void newFromStr                                ( IMPL_RTL_STRINGDATA** ppThis,
                                                  const STRCODE<IMPL_RTL_STRINGDATA>* pCharStr )
{
#if OSL_DEBUG_LEVEL > 0
     //TODO: For now, only abort in non-production debug builds; once all places that rely on the
     // undocumented newFromStr behavior of treating a null pCharStr like an empty string have been
     // found and fixed, drop support for that behavior and turn this into a general assert:
     if (pCharStr == nullptr) {
         std::abort();
     }
#endif
     newFromStr_WithLength(ppThis, pCharStr, pCharStr ? getLength(pCharStr) : 0);
}

how to check if OUString is NULL ?

Regards
Oliver


More information about the LibreOffice mailing list