src/core/trace-resolver.cc
changeset 2332 200875532591
parent 1504 36ecc970ba96
--- a/src/core/trace-resolver.cc	Thu Feb 14 17:48:15 2008 +0000
+++ b/src/core/trace-resolver.cc	Thu Feb 14 18:15:26 2008 +0000
@@ -19,6 +19,7 @@
  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
  */
 #include "trace-resolver.h"
+#include "assert.h"
 #include "log.h"
 
 NS_LOG_COMPONENT_DEFINE ("TraceResolver");
@@ -53,6 +54,10 @@
 {
   std::string::size_type cur = 1;
   // check that first char is "/"
+  if (path[0] != '/')
+    {
+      NS_FATAL_ERROR ("Malformed trace path (must start with '/'): '" << path << "'");
+    }
   std::string::size_type next = path.find ("/", cur);
   std::string id = std::string (path, cur, next-1);
   return id;
@@ -62,6 +67,10 @@
 {
   std::string::size_type cur = 1;
   // check that first char is "/"
+  if (path[0] != '/')
+    {
+      NS_FATAL_ERROR ("Malformed trace path (must start with '/'): '" << path << "'");
+    }
   std::string::size_type next = path.find ("/", cur);
   std::string subpath;
   if (next != std::string::npos)