summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@nokia.com>2011-12-06 15:23:46 +0100
committerEike Ziller <eike.ziller@nokia.com>2011-12-06 16:02:30 +0100
commit0840b93ff5cc03df9521ef23ab9ac0b0d0ec9339 (patch)
treece34c460fcac09991c61ad188f4fd9a6d7b48351
parenta1b2fc95f3145e641e421205bfec38f351f16d97 (diff)
downloadqt-creator-0840b93ff5cc03df9521ef23ab9ac0b0d0ec9339.tar.gz
Fix possible crash in environmentsmodel
Change-Id: Ib6a3450a7974dc568ba07633a38a29d598a9099f Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
-rw-r--r--src/libs/utils/environmentmodel.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libs/utils/environmentmodel.cpp b/src/libs/utils/environmentmodel.cpp
index 616feddc4a..14b8a4ac5a 100644
--- a/src/libs/utils/environmentmodel.cpp
+++ b/src/libs/utils/environmentmodel.cpp
@@ -211,7 +211,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
const QString &newName = value.toString();
#endif
// Does the new name exist already?
- if (d->m_resultEnvironment.hasKey(newName))
+ if (d->m_resultEnvironment.hasKey(newName) || newName.isEmpty())
return false;
Utils::EnvironmentItem newVariable(newName, oldValue);
@@ -227,7 +227,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
const QString stringValue = value.toString();
if (changesPos != -1) {
// We have already changed this value
- if (stringValue == d->m_baseEnvironment.value(oldName)) {
+ if (d->m_baseEnvironment.hasKey(oldName) && stringValue == d->m_baseEnvironment.value(oldName)) {
// ... and now went back to the base value
d->m_items.removeAt(changesPos);
} else {