]> git.tdb.fi Git - builder.git/commitdiff
Add a sanity check for derived tool commands
authorMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 19:01:30 +0000 (21:01 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 26 Dec 2022 19:13:04 +0000 (21:13 +0200)
It doesn't seem correct to copy the command in CustomizedTool, since
often the derived class will want to use a different command anyway.

source/tool.cpp

index 82349e18eea50b747d8870ffb3f3113980dc7216..eaf4977d8c16030f2aa1bb0994ad3abc1d67c900 100644 (file)
@@ -59,6 +59,9 @@ void Tool::prepare(Tool &tool) const
        if(&tool!=this && tool.get_base_tool()!=this)
                throw invalid_argument("Tool::prepare");
 
+       if(&tool!=this && !command.empty() && tool.command.empty())
+               throw logic_error("Derived tool has no command");
+
        do_prepare(tool);
 }