From e9e9b639fbbf500866ec1814dee6b504bcb99f3d Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 19 Dec 2022 20:08:13 +0200 Subject: [PATCH] Refuse to create an empty data pack This avoids a segfault from trying to access te front element of an empty list. --- source/datatool.cpp | 2 ++ 1 file changed, 2 insertions(+) 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)); -- 2.45.2