aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/classview/classviewutils.cpp
diff options
context:
space:
mode:
authorThiago Macieira <[email protected]>2022-06-01 11:09:54 -0700
committerThiago Macieira <[email protected]>2022-06-06 15:53:20 +0000
commit9fb8b4af8158d8b560ca8f4010469b0fbaf10520 (patch)
treee2d2c7c3f088186611690933baf471312de950f7 /src/plugins/classview/classviewutils.cpp
parent5947b3c9f01a928b0b7a87dfab585acfdb3dedc9 (diff)
Fix GCC 12 warning about use of uninitialized value
False positive, it couldn't be. `ok` could only become true if var.toInt() was called, which means some value was assigned to `value`. But anyway, we can simplify this because QVariant::toInt() returns 0 when it sets ok to false. classviewutils.cpp:78:50: warning: ‘value’ may be used uninitialized [-Wmaybe-uninitialized] 78 | return SymbolInformation(name, type, iconType); | ^ Change-Id: Iba16e8ea451b444ab213fffd16f4918c45228f2c Reviewed-by: Christian Stenger <[email protected]>
Diffstat (limited to 'src/plugins/classview/classviewutils.cpp')
-rw-r--r--src/plugins/classview/classviewutils.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/plugins/classview/classviewutils.cpp b/src/plugins/classview/classviewutils.cpp
index cebea9a6f28..a8d1249d760 100644
--- a/src/plugins/classview/classviewutils.cpp
+++ b/src/plugins/classview/classviewutils.cpp
@@ -65,15 +65,7 @@ SymbolInformation symbolInformationFromItem(const QStandardItem *item)
const QString &name = item->data(Constants::SymbolNameRole).toString();
const QString &type = item->data(Constants::SymbolTypeRole).toString();
- int iconType = 0;
-
- QVariant var = item->data(Constants::IconTypeRole);
- bool ok = false;
- int value;
- if (var.isValid())
- value = var.toInt(&ok);
- if (ok)
- iconType = value;
+ int iconType = item->data(Constants::IconTypeRole).toInt();
return SymbolInformation(name, type, iconType);
}