diff --git a/src/box2d.cpp b/src/box2d.cpp index 26e69293c..ea7874269 100644 --- a/src/box2d.cpp +++ b/src/box2d.cpp @@ -372,9 +372,16 @@ template std::string box2d::to_string() const { std::ostringstream s; - s << "box2d(" << std::fixed << std::setprecision(16) - << minx_ << ',' << miny_ << ',' - << maxx_ << ',' << maxy_ << ')'; + if (valid()) + { + s << "box2d(" << std::fixed << std::setprecision(16) + << minx_ << ',' << miny_ << ',' + << maxx_ << ',' << maxy_ << ')'; + } + else + { + s << "box2d(INVALID)"; + } return s.str(); }