From 338674a9e600c19aef628d4ce47dff5b8e983075 Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 5 Apr 2021 21:11:13 +0200 Subject: [PATCH] Fix returning output when no offset present --- librepomgr/webapi/routes_buildaction.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/librepomgr/webapi/routes_buildaction.cpp b/librepomgr/webapi/routes_buildaction.cpp index efd0e3a..77a8967 100644 --- a/librepomgr/webapi/routes_buildaction.cpp +++ b/librepomgr/webapi/routes_buildaction.cpp @@ -116,11 +116,13 @@ void getBuildActionOutput(const Params ¶ms, ResponseHandler &&handler) handler(makeBadRequest(params.request(), "the offset parameter must be specified at most once")); return; } - try { - offset = stringToNumber(offsetParams.front()); - } catch (const ConversionException &) { - handler(makeBadRequest(params.request(), "the offset must be an unsigned integer")); - return; + if (!offsetParams.empty()) { + try { + offset = stringToNumber(offsetParams.front()); + } catch (const ConversionException &) { + handler(makeBadRequest(params.request(), "the offset must be an unsigned integer")); + return; + } } auto buildActionsSearchResult = findBuildActions(params, std::move(handler), false, 1); if (!buildActionsSearchResult.ok) {