smell: throwing heap object

null check.
This commit is contained in:
Scott Giese 2020-11-23 16:16:14 -06:00
parent 112c9a110b
commit 7673da3832

View File

@ -22,13 +22,14 @@ public:
// as this is going to segfault ignore the translation of severity and always output the message. // as this is going to segfault ignore the translation of severity and always output the message.
SG_LOG(SG_GL, SG_ALERT, message); SG_LOG(SG_GL, SG_ALERT, message);
#ifndef DEBUG #ifndef DEBUG
throw new std::string(message); throw std::string(message);
//int* trigger_segfault = 0; //int* trigger_segfault = 0;
//*trigger_segfault = 0; //*trigger_segfault = 0;
#endif #endif
return; return;
} }
char*tmessage = strdup(message); char*tmessage = strdup(message);
if (tmessage) {
char*lf = strrchr(tmessage, '\n'); char*lf = strrchr(tmessage, '\n');
if (lf) if (lf)
*lf = 0; *lf = 0;
@ -36,6 +37,7 @@ public:
SG_LOG(SG_OSG, translateSeverity(severity), tmessage); SG_LOG(SG_OSG, translateSeverity(severity), tmessage);
free(tmessage); free(tmessage);
} }
}
private: private:
sgDebugPriority translateSeverity(osg::NotifySeverity severity) { sgDebugPriority translateSeverity(osg::NotifySeverity severity) {