Merge PR #267: Don't compare QUUid with QStrings in an unsafe way

This commit is contained in:
Jenkins nymea 2019-11-18 21:50:03 +01:00
commit 206f53fae3
2 changed files with 5 additions and 4 deletions

View File

@ -23,6 +23,7 @@
#include "params.h"
#include <QDebug>
#include <QUuid>
Params::Params(QObject *parent) :
QAbstractListModel(parent)
@ -50,7 +51,7 @@ Param *Params::get(int index) const
Param *Params::getParam(QString paramTypeId) const
{
foreach (Param *param, m_params) {
if (param->paramTypeId() == paramTypeId) {
if (QUuid(param->paramTypeId()) == QUuid(paramTypeId)) {
return param;
}
}

View File

@ -43,11 +43,11 @@ ParamType *ParamTypes::get(int index) const
ParamType *ParamTypes::getParamType(const QString &id) const
{
foreach (ParamType *paramType, m_paramTypes) {
if (paramType->id() == id) {
if (paramType->id() == QUuid(id)) {
return paramType;
}
}
return 0;
return nullptr;
}
ParamType *ParamTypes::findByName(const QString &name) const
@ -57,7 +57,7 @@ ParamType *ParamTypes::findByName(const QString &name) const
return paramType;
}
}
return 0;
return nullptr;
}
int ParamTypes::rowCount(const QModelIndex &parent) const