[libraries/ktextaddons] textautogeneratetext/core: Reduce variable scope

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 7f323e9a5d4cce1618a15e7f323ec6b2cb43bb9a by Laurent Montel.
Committed on 31/07/2026 at 05:30.
Pushed by mlaurent into branch 'master'.

Reduce variable scope

M  +1    -1    textautogeneratetext/core/textautogeneratechat.cpp

https://invent.kde.org/libraries/ktextaddons/-/commit/7f323e9a5d4cce1618a15e7f323ec6b2cb43bb9a

diff --git a/textautogeneratetext/core/textautogeneratechat.cpp b/textautogeneratetext/core/textautogeneratechat.cpp
index bb42c45eb..1fdb132c6 100644
--- a/textautogeneratetext/core/textautogeneratechat.cpp
+++ b/textautogeneratetext/core/textautogeneratechat.cpp
@@ -128,7 +128,6 @@ void TextAutoGenerateChat::setDateTime(qint64 dt)
 
 QByteArray TextAutoGenerateChat::serialize(const TextAutoGenerateChat &chat, bool toBinary)
 {
-    QJsonDocument d;
     QJsonObject o;
     o["title"_L1] = chat.title();
     o["favorite"_L1] = chat.mFavorite;
@@ -143,6 +142,7 @@ QByteArray TextAutoGenerateChat::serialize(const TextAutoGenerateChat &chat, boo
     if (toBinary) {
         return QCborValue::fromJsonValue(o).toCbor();
     }
+    QJsonDocument d;
     d.setObject(o);
     return d.toJson(QJsonDocument::Indented);
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.