[PATCH] Fix crash when trying to save less than the max number of fields
authorJoshua Goins <josh@redstrate.com>
Mon, 7 Jul 2025 01:50:54 +0000 (21:50 -0400)
committerAurélien COUDERC <coucouf@debian.org>
Thu, 24 Jul 2025 16:34:20 +0000 (18:34 +0200)
(cherry picked from commit 049ce8700af96134a0fcfc575016514b4ae0e912)

Gbp-Pq: Name upstream_9eb657e1_Fix-crash-when-trying-to-save-less-than-the-max-number-of-fields.patch

src/account/profileeditor.cpp

index 17c77004d3513334d9ca5892aa00275485617f6b..2cdd3471b86438a614e8b2beec8b68046be60538 100644 (file)
@@ -285,7 +285,7 @@ void ProfileEditorBackend::save()
     discoverablePart.setBody(discoverable() ? "1" : "0");
     multiPart->append(discoverablePart);
 
-    for (int i = 0; i < maxFields(); i++) {
+    for (int i = 0; i < m_fields.size(); i++) {
         QHttpPart fieldNamePart;
         fieldNamePart.setHeader(QNetworkRequest::ContentDispositionHeader, QStringLiteral("form-data; name=\"fields_attributes[%1][name]\"").arg(i));
         fieldNamePart.setBody(m_fields[i]["name"_L1].toString().toUtf8());