mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 10:00:40 +00:00
[Coverity] Add some handling for return values in UI code
This commit is contained in:
@@ -402,35 +402,43 @@ void PerformanceCounterSelection::Load()
|
||||
QFile f(filename);
|
||||
if(f.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
LoadFromJSON(doc, f, JSON_ID, JSON_VER);
|
||||
bool success = LoadFromJSON(doc, f, JSON_ID, JSON_VER);
|
||||
|
||||
QSet<GPUCounter> selectedCounters;
|
||||
|
||||
QVariantList counters = doc[lit("counters")].toList();
|
||||
|
||||
for(const QVariant &counter : counters)
|
||||
if(success)
|
||||
{
|
||||
QVariantList bytes = counter.toList();
|
||||
Uuid uuid;
|
||||
QSet<GPUCounter> selectedCounters;
|
||||
|
||||
if(bytes.size() != 4)
|
||||
QVariantList counters = doc[lit("counters")].toList();
|
||||
|
||||
for(const QVariant &counter : counters)
|
||||
{
|
||||
qWarning() << "Counter ID doesn't count 4 words";
|
||||
continue;
|
||||
QVariantList bytes = counter.toList();
|
||||
Uuid uuid;
|
||||
|
||||
if(bytes.size() != 4)
|
||||
{
|
||||
qWarning() << "Counter ID doesn't count 4 words";
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
uuid.words[i] = bytes[i].toUInt();
|
||||
}
|
||||
|
||||
if(!m_UuidToCounter.contains(uuid))
|
||||
continue;
|
||||
|
||||
selectedCounters.insert(m_UuidToCounter[uuid]);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; ++i)
|
||||
{
|
||||
uuid.words[i] = bytes[i].toUInt();
|
||||
}
|
||||
|
||||
if(!m_UuidToCounter.contains(uuid))
|
||||
continue;
|
||||
|
||||
selectedCounters.insert(m_UuidToCounter[uuid]);
|
||||
SetSelectedCounters(selectedCounters.toList());
|
||||
}
|
||||
else
|
||||
{
|
||||
RDDialog::critical(this, tr("Error loading config"),
|
||||
tr("Couldn't interpret settings in %1.").arg(filename));
|
||||
}
|
||||
|
||||
SetSelectedCounters(selectedCounters.toList());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user