From fc7802ea0f28aa74da3b4843a7db73d064843c72 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Sat, 4 Aug 2007 16:03:08 +0200 Subject: [PATCH] avoid fatal error if NS_DEBUG is used before the 'main' function is reached --- src/core/debug.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/debug.cc b/src/core/debug.cc index 181bb9622..3dfb998b5 100644 --- a/src/core/debug.cc +++ b/src/core/debug.cc @@ -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; }