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

package info (click to toggle)
tokodon 25.04.3-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 10,276 kB
  • sloc: cpp: 20,221; xml: 389; python: 160; java: 75; makefile: 5; sh: 1
file content (27 lines) | stat: -rw-r--r-- 1,096 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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