stringFromIslObj: Do not crash when printing 'null' objects

No test case, as this code path is currently only used for debugging.

llvm-svn: 252609
This commit is contained in:
Tobias Grosser 2015-11-10 15:09:44 +00:00
parent 1e9ef81187
commit b43cc62fe1

View File

@ -74,7 +74,11 @@ static inline std::string stringFromIslObjInternal(__isl_keep ISLTy *isl_obj,
isl_printer *p = isl_printer_to_str(ctx);
printer_fn(p, isl_obj);
char *char_str = isl_printer_get_str(p);
std::string string(char_str);
std::string string;
if (char_str)
string = char_str;
else
string = "null";
free(char_str);
isl_printer_free(p);
return string;