From 74f1d58f0ba1b69bbf057538cf2f88372659fc91 Mon Sep 17 00:00:00 2001 From: Nicolas Mailloux Date: Thu, 23 Jun 2022 00:56:07 -0400 Subject: [PATCH] userapps.cpp: Write 'None' if no required feature found --- userapps.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/userapps.cpp b/userapps.cpp index 7c8d15b..37b40f8 100644 --- a/userapps.cpp +++ b/userapps.cpp @@ -233,7 +233,12 @@ QString userapps::parseJsonShow(QJsonObject json) else if(value.isArray()) { QJsonArray array = value.toArray(); if(key == "RequiredFeatures") { + bool foundRequiredFeature = false; + appendString.append("None"); + for(QJsonValueRef ref: array) { + foundRequiredFeature = true; + appendString.remove(appendString.size() - 4, 4); int id = ref.toInt(); if(id == 0) { appendString.append("Wi-Fi connection"); @@ -246,7 +251,10 @@ QString userapps::parseJsonShow(QJsonObject json) } appendString.append(", "); } - appendString.remove(appendString.size() - 2, 2); + + if(foundRequiredFeature == true) { + appendString.remove(appendString.size() - 2, 2); + } } else if(key == "SupportedDevices") { for(QJsonValueRef ref: array) {