From b9e6df320cb73cfd7c7be74169a373531de36554 Mon Sep 17 00:00:00 2001 From: Karl Fleischmann Date: Mon, 1 Jun 2026 09:49:58 +0200 Subject: [PATCH] gui: Guard against accessing unavailable macro delay content --- src/gui/kbbind.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gui/kbbind.cpp b/src/gui/kbbind.cpp index 5bc431f9..a8419a05 100644 --- a/src/gui/kbbind.cpp +++ b/src/gui/kbbind.cpp @@ -245,11 +245,11 @@ void KbBind::update(QFile& cmd, int notify, bool force){ #else // QT_VERSION < 6.0.0 QVector macroContent = act->value().splitRef(':'); #endif - if (macroContent[1].length() > 0) - // Fields used: 1 - daemon string, 5 - repetition delay - macros.append("macro " + keyLatin1 - + ":" + macroContent[1].toLatin1() - + ":" + macroContent[5].toLatin1()); + // Fields used: 1 - daemon string, 5 - repetition delay + if (macroContent.at(1).length() > 0) + macros.append("macro " + keyLatin1 + ":" + macroContent.at(1).toLatin1()); + if (macroContent.length() > 5 && macroContent.at(5).length() > 0) + macros.append(":" + macroContent.at(5).toLatin1()); } } else { // Otherwise, write the binding