avoid fatal error if NS_DEBUG is used before the 'main' function is reached
This commit is contained in:
@@ -54,6 +54,7 @@ DebugComponentEnableEnvVar (void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool allFound = true;
|
||||
std::string env = envVar;
|
||||
std::string::size_type cur = 0;
|
||||
std::string::size_type next = 0;
|
||||
@@ -89,7 +90,7 @@ DebugComponentEnableEnvVar (void)
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
NS_FATAL_ERROR ("No debug component named=\"" << tmp << "\"");
|
||||
allFound = false;
|
||||
}
|
||||
if (next == std::string::npos)
|
||||
{
|
||||
@@ -101,6 +102,11 @@ DebugComponentEnableEnvVar (void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allFound)
|
||||
{
|
||||
g_firstDebug = true;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -123,7 +129,6 @@ DebugComponent::IsEnabled (void)
|
||||
if (g_firstDebug)
|
||||
{
|
||||
DebugComponentEnableEnvVar ();
|
||||
g_firstDebug = false;
|
||||
}
|
||||
return m_isEnabled;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user