Fixes some problems reported by Coverity

- Unchecked dynamic_cast
- Uninitialized scalar field
- Uninitialized pointer field
- Big parameter passed by value
This commit is contained in:
mgrojo
2019-08-02 17:19:28 +02:00
parent 12c6a66375
commit bef856ef45
5 changed files with 7 additions and 4 deletions

View File

@@ -82,7 +82,7 @@ public:
void setEditorData(QWidget *editor, const QModelIndex &index) const override {
NullLineEdit* lineEditor = dynamic_cast<NullLineEdit*>(editor);
NullLineEdit* lineEditor = static_cast<NullLineEdit*>(editor);
// Set the editor in the null state (unless the user has actually written NULL)
if (index.model()->data(index, Qt::UserRole).isNull() &&
index.model()->data(index, Qt::DisplayRole) == Settings::getValue("databrowser", "null_text"))
@@ -94,7 +94,7 @@ public:
}
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override {
NullLineEdit* lineEditor = dynamic_cast<NullLineEdit*>(editor);
NullLineEdit* lineEditor = static_cast<NullLineEdit*>(editor);
// Restore NULL text (unless the user has already modified the value)
if (lineEditor->isNull() && !lineEditor->isModified()) {
model->setData(index, Settings::getValue("databrowser", "null_text"), Qt::DisplayRole);