From 9eb657e17e6596e007cfaf3524d11d37c5a9148b Mon Sep 17 00:00:00 2001
From: Joshua Goins <josh@redstrate.com>
Date: Sun, 6 Jul 2025 21:50:54 -0400
Subject: [PATCH] Fix crash when trying to save less than the max number of
 fields

(cherry picked from commit 049ce8700af96134a0fcfc575016514b4ae0e912)
---
 src/account/profileeditor.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/account/profileeditor.cpp b/src/account/profileeditor.cpp
index ea402f11f..0ab785e62 100644
--- a/src/account/profileeditor.cpp
+++ b/src/account/profileeditor.cpp
@@ -292,7 +292,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());
-- 
GitLab

