diff options
-rw-r--r-- | sal/rtl/bootstrap.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index a4169b3b66b9..5ee61b0a19ba 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -199,9 +199,18 @@ static sal_Bool getFromCommandLineArgs( } rtl_uString_release( pArg ); } - pNameValueList = &nameValueList; + // If osl_setCommandArgs() has not been called yet (for + // instance, if this gets called from a static initialiser), + // don't initialise pNameValueList, as that would cause the + // code to ignore any -env:FOO=BAR on the command line once + // osl is told about it. + if( nArgCount > 0 ) + pNameValueList = &nameValueList; } + if( ! pNameValueList ) + return sal_False; + sal_Bool found = sal_False; for( NameValueList::iterator ii = pNameValueList->begin() ; |