Skip to content

Commit

Permalink
Check if gCoreContext is initialized before using
Browse files Browse the repository at this point in the history
  • Loading branch information
Beirdo committed Apr 28, 2011
1 parent f1f5774 commit 65899d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbase/mythlogging.cpp
Expand Up @@ -208,7 +208,7 @@ DatabaseLogger::DatabaseLogger(char *table) : LoggerBase(table, 0),
LogPrint(VB_IMPORTANT, LOG_INFO, "Added database logging to table %s",
m_handle.string);

if (!gCoreContext->GetHostName().isEmpty())
if (gCoreContext && !gCoreContext->GetHostName().isEmpty())
m_host = strdup((char *)gCoreContext->GetHostName()
.toLocal8Bit().constData());

Expand Down Expand Up @@ -241,7 +241,7 @@ bool DatabaseLogger::logmsg(LoggingItem_t *item)
strftime( timestamp, TIMESTAMP_MAX-8, "%Y-%m-%d %H:%M:%S",
(const struct tm *)&item->tm );

if( !m_host )
if( gCoreContext && !m_host )
m_host = strdup((char *)gCoreContext->GetHostName()
.toLocal8Bit().constData());

Expand Down

0 comments on commit 65899d0

Please sign in to comment.