|
From: stephan b. <sg...@us...> - 2004-12-24 23:01:52
|
Update of /cvsroot/pclasses/pclasses2/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7092/src Modified Files: Exception.cpp Log Message: Added a fix for a segfault when passed an empty string. Index: Exception.cpp =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/Exception.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Exception.cpp 24 Dec 2004 17:16:57 -0000 1.4 +++ Exception.cpp 24 Dec 2004 23:01:35 -0000 1.5 @@ -23,7 +23,7 @@ namespace P { Exception::Exception(const char* what, const SourceInfo& si) throw() - : _what(what), _source(&si), _where() + : _what(what?what:""), _source(&si), _where() { } @@ -45,12 +45,22 @@ { if( _where.empty() && _source ) { - _where = "[file = "; - _where += _source->file(); - _where += " : line = "; - _where += _source->line(); - _where += " : function = "; - _where += _source->func(); + _where = "["; + if( _source->file() ) + { + _where += "file = "; + _where += _source->file(); + } + if( _source->line() ) + { + _where += ": line = "; + _where += _source->line(); + } +// if( _source->func() ) +// { +// _where += " : function = "; +// _where += _source->func(); // segfault here +// } _where += "]"; } return _where.c_str(); |