diff --git a/src/dgraph/import.cpp b/src/dgraph/import.cpp index 9f93fb73ea0d5c30f560f3c94f5295fda4fa402e..9f2bf4f867f12bf0e7fcb62a4aee06ed589fbab8 100644 --- a/src/dgraph/import.cpp +++ b/src/dgraph/import.cpp @@ -314,6 +314,15 @@ namespace dynamicgraph std::string path; cmdArg >> path; removeQuotes (path); + if (path.empty ()) + DG_THROW ExceptionFactory + (ExceptionFactory::SYNTAX_ERROR, + "pushImportPaths expects exactly one argument."); + + if (!cmdArg.eof ()) + DG_THROW ExceptionFactory + (ExceptionFactory::SYNTAX_ERROR, + "pushImportPaths expects exactly one argument."); importPaths.push_back (path); } @@ -331,6 +340,11 @@ namespace dynamicgraph } if (!importPaths.empty ()) importPaths.pop_back (); + else + //FIXME: get a better error code for this. + DG_THROW ExceptionFactory + (ExceptionFactory::SYNTAX_ERROR, + "Vector is already empty."); } } // end of namespace command.