Code

Geom: fix a crash on assertion in sbasis-to-bezier.cpp
authorjohanengelen <johanengelen@users.sourceforge.net>
Thu, 17 Jan 2008 21:04:37 +0000 (21:04 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Thu, 17 Jan 2008 21:04:37 +0000 (21:04 +0000)
src/2geom/exception.h
src/2geom/sbasis-to-bezier.cpp

index 0791c85475f67f120841add7ebe1abfa18652bab..920cd58082080489ac5216018f9664a3f5ef13cd 100644 (file)
@@ -53,6 +53,7 @@ public:
 protected:
     std::string msgstr;
 };
+#define throwException(message) throw(Geom::Exception(message, __FILE__, __LINE__))
 
 //-----------------------------------------------------------------------
 // Two main exception classes: LogicalError and RangeError.
index 415b30d8989f823f64ca49cf65bd7626c345d759..497091d1c65f29e7b95b4d4dc9d4e7ffd61ddd6d 100644 (file)
@@ -13,6 +13,7 @@ This is wrong, it should read
 #include "choose.h"
 #include "svg-path.h"
 #include <iostream>
+#include "exception.h"
 
 namespace Geom{
 
@@ -179,7 +180,9 @@ subpath_from_sbasis_incremental(Geom::OldPathSetBuilder &pb, D2<SBasis> B, doubl
 #endif
 
 void build_from_sbasis(Geom::PathBuilder &pb, D2<SBasis> const &B, double tol) {
-    assert(B.isFinite());
+    if (!B.isFinite()) {
+        throwException("assertion failed: B.isFinite()");
+    }
     if(tail_error(B, 2) < tol || sbasis_size(B) == 2) { // nearly cubic enough
         if(sbasis_size(B) <= 1) {
             pb.lineTo(B.at1());