]> git.tdb.fi Git - r2c2.git/commitdiff
Ensure that turnout tracks have a turnout id
authorMikko Rasa <tdb@tdb.fi>
Fri, 7 Jun 2013 16:17:19 +0000 (19:17 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 7 Jun 2013 16:17:19 +0000 (19:17 +0300)
source/libr2c2/track.cpp

index 51c73c237ccd27a8873ae26effc0a632434dc2c5..ecb86bbad33ad02e20699a05ef7655eb3d2d30a0 100644 (file)
@@ -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);