diff --git a/gtsam/slam/dataset.cpp b/gtsam/slam/dataset.cpp index 46f8740f9..e22d0b42c 100644 --- a/gtsam/slam/dataset.cpp +++ b/gtsam/slam/dataset.cpp @@ -91,7 +91,8 @@ pair load2D( // load the poses while (is) { - is >> tag; + if(! (is >> tag)) + break; if ((tag == "VERTEX2") || (tag == "VERTEX")) { int id; @@ -113,7 +114,8 @@ pair load2D( // load the factors bool haveLandmark = false; while (is) { - is >> tag; + if(! (is >> tag)) + break; if ((tag == "EDGE2") || (tag == "EDGE") || (tag == "ODOMETRY")) { int id1, id2;