diff --git a/lemon/lgf_reader.h b/lemon/lgf_reader.h --- a/lemon/lgf_reader.h +++ b/lemon/lgf_reader.h @@ -467,7 +467,7 @@ : _is(other._is), local_is(other.local_is), _digraph(other._digraph), _use_nodes(other._use_nodes), _use_arcs(other._use_arcs) { - other.is = 0; + other._is = 0; other.local_is = false; _node_index.swap(other._node_index); @@ -1078,8 +1078,10 @@ /// /// This function starts the batch processing void run() { - LEMON_ASSERT(_is != 0, "This reader assigned to an other reader"); + if (!*_is) { + throw DataFormatError("Cannot find file"); + } bool nodes_done = false; bool arcs_done = false; @@ -1160,20 +1162,23 @@ /// \relates DigraphReader template DigraphReader digraphReader(std::istream& is, Digraph& digraph) { - return DigraphReader(is, digraph); + DigraphReader tmp(is, digraph); + return tmp; } /// \relates DigraphReader template DigraphReader digraphReader(const std::string& fn, Digraph& digraph) { - return DigraphReader(fn, digraph); + DigraphReader tmp(fn, digraph); + return tmp; } /// \relates DigraphReader template DigraphReader digraphReader(const char* fn, Digraph& digraph) { - return DigraphReader(fn, digraph); + DigraphReader tmp(fn, digraph); + return tmp; } }