From ef4413633a246ff85ef1f9d42f2fdfedbe3af9db Mon Sep 17 00:00:00 2001 From: ebbit1q Date: Mon, 29 Jul 2024 03:20:50 +0200 Subject: [PATCH] fix regression in #4762 to _fill_with_ template (#5083) fixes #5062 --- cockatrice/src/pictureloader.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cockatrice/src/pictureloader.cpp b/cockatrice/src/pictureloader.cpp index d22923c7d..b7f4a7fc1 100644 --- a/cockatrice/src/pictureloader.cpp +++ b/cockatrice/src/pictureloader.cpp @@ -284,15 +284,17 @@ static int parse(const QString &urlTemplate, return 1; } else { int propLength = propertyValue.length(); - if (subStrLen > 0 && subStrPos + subStrLen > propLength) { - qDebug().nospace() << "PictureLoader: [card: " << cardName << " set: " << setName << "]: Requested " - << propType << " property (" << cardPropertyName << ") for Url template (" - << urlTemplate << ") is smaller than substr specification (" << subStrPos << " + " - << subStrLen << " > " << propLength << ")"; - return 1; - } else { - propertyValue = propertyValue.mid(subStrPos, subStrLen); - propLength = subStrLen; + if (subStrLen > 0) { + if (subStrPos + subStrLen > propLength) { + qDebug().nospace() << "PictureLoader: [card: " << cardName << " set: " << setName << "]: Requested " + << propType << " property (" << cardPropertyName << ") for Url template (" + << urlTemplate << ") is smaller than substr specification (" << subStrPos + << " + " << subStrLen << " > " << propLength << ")"; + return 1; + } else { + propertyValue = propertyValue.mid(subStrPos, subStrLen); + propLength = subStrLen; + } } if (!fillWith.isEmpty()) {