Skip to content

Commit

Permalink
try to trap conditions where Debug* is no longer available
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Oct 23, 2012
1 parent 1c53698 commit 740461a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions include/pdal/GDALUtils.hpp
Expand Up @@ -63,8 +63,16 @@ class PDAL_DLL Debug

static void CPL_STDCALL trampoline(::CPLErr code, int num, char const* msg)
{
#if ((GDAL_VERSION_MAJOR == 1 && GDAL_VERSION_MINOR >= 9) || (GDAL_VERSION_MAJOR > 1))
static_cast<Debug*>(CPLGetErrorHandlerUserData())->m_gdal_callback(code, num, msg);
#if ((GDAL_VERSION_MAJOR == 1 && GDAL_VERSION_MINOR >= 9) || (GDAL_VERSION_MAJOR > 1))


Debug* debug = static_cast<Debug*>(CPLGetErrorHandlerUserData());
if (!debug)
return;

debug->m_gdal_callback(code, num, msg);

if (!debug->m_log->get()) return;
#else
if (code == CE_Failure || code == CE_Fatal)
{
Expand All @@ -86,7 +94,6 @@ class PDAL_DLL Debug
void log(::CPLErr code, int num, char const* msg);
void error(::CPLErr code, int num, char const* msg);


private:
boost::function<void(CPLErr, int, char const*)> m_gdal_callback;
bool m_isDebug;
Expand Down

0 comments on commit 740461a

Please sign in to comment.