tdf#120703 PVS: dereference before nullptr check
V595 The 'ustrFile' pointer was utilized before it was verified against nullptr.
Check lines: 83, 107.
Change-Id: I874983508fb805b1f0a55b3a5b6d4d78ae1babdb
Reviewed-on: https://gerrit.libreoffice.org/71472
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sal/osl/all/filepath.cxx b/sal/osl/all/filepath.cxx
index 7e8022f..ae917c6 100644
--- a/sal/osl/all/filepath.cxx
+++ b/sal/osl/all/filepath.cxx
@@ -19,6 +19,7 @@
#include <osl/file.h>
#include <rtl/ustring.h>
#include <cassert>
static sal_uInt32 osl_defCalcTextWidth( rtl_uString *ustrText )
{
@@ -49,6 +50,8 @@
}
}
assert(ustrPath && ustrFile);
uPathWidth = pfnCalcWidth( ustrPath );
uFileWidth = pfnCalcWidth( ustrFile );
@@ -101,11 +104,8 @@
uPathWidth = pfnCalcWidth( *pustrCompacted );
}
if ( ustrPath )
rtl_uString_release( ustrPath );
if ( ustrFile )
rtl_uString_release( ustrFile );
rtl_uString_release(ustrPath);
rtl_uString_release(ustrFile);
return osl_File_E_None;
}