From: Mikko Rasa Date: Mon, 19 Dec 2022 18:08:13 +0000 (+0200) Subject: Refuse to create an empty data pack X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=e9e9b639fbbf500866ec1814dee6b504bcb99f3d;p=builder.git Refuse to create an empty data pack This avoids a segfault from trying to access te front element of an empty list. --- diff --git a/source/datatool.cpp b/source/datatool.cpp index ca2f2e4..d23c00d 100644 --- a/source/datatool.cpp +++ b/source/datatool.cpp @@ -37,6 +37,8 @@ Target *DataTool::create_target(const list &sources, const string &arg } else if(arg=="pack") { + if(sources.empty()) + throw invalid_argument("DataTool::create_target"); list files; for(Target *t: sources) files.push_back(&dynamic_cast(*t));