From: Mikko Rasa Date: Fri, 7 Jun 2013 16:17:19 +0000 (+0300) Subject: Ensure that turnout tracks have a turnout id X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=2922bc5d2ba68979d186fd09df8b4ec6ba98402b;p=r2c2.git Ensure that turnout tracks have a turnout id --- diff --git a/source/libr2c2/track.cpp b/source/libr2c2/track.cpp index 51c73c2..ecb86bb 100644 --- a/source/libr2c2/track.cpp +++ b/source/libr2c2/track.cpp @@ -123,6 +123,8 @@ void Track::set_turnout_id(unsigned i) { if(!type.is_turnout()) throw logic_error("not a turnout"); + if(!i) + throw invalid_argument("Track::set_turnout_id"); turnout_id = i; layout.create_blocks(*this);