summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess.cpp13
-rw-r--r--src/corelib/io/qprocess_p.h3
2 files changed, 11 insertions, 5 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 7c13bf0..733887a 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -293,7 +293,8 @@ bool QProcessEnvironment::isEmpty() const
*/
void QProcessEnvironment::clear()
{
- d->hash.clear();
+ if (d)
+ d->hash.clear();
}
/*!
@@ -345,7 +346,8 @@ void QProcessEnvironment::insert(const QString &name, const QString &value)
*/
void QProcessEnvironment::remove(const QString &name)
{
- d->hash.remove(prepareName(name));
+ if (d)
+ d->hash.remove(prepareName(name));
}
/*!
@@ -364,8 +366,11 @@ QString QProcessEnvironment::value(const QString &name, const QString &defaultVa
if (!d)
return defaultValue;
- QProcessEnvironmentPrivate::Unit result = d->hash.value(prepareName(name), prepareValue(defaultValue));
- return valueToString(result);
+ QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(prepareName(name));
+ if (it == d->hash.constEnd())
+ return defaultValue;
+
+ return valueToString(it.value());
}
/*!
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 1e2979b..b581e91 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -86,7 +86,8 @@ public:
#else
typedef QByteArray Unit;
#endif
- QHash<Unit, Unit> hash;
+ typedef QHash<Unit, Unit> Hash;
+ Hash hash;
static QProcessEnvironment fromList(const QStringList &list);
QStringList toList() const;