Skip to content
Snippets Groups Projects
Commit d8ac419e authored by Daniel Teske's avatar Daniel Teske
Browse files

VcsBaseClientSetting, check the type before returning from the union

Change-Id: Ic40b88e1cf9b731509edc6636c1e0bdb5f053529
Reviewed-on: http://codereview.qt-project.org/6234


Reviewed-by: default avatarDaniel Teske <daniel.teske@nokia.com>
parent 368726d6
No related branches found
No related tags found
No related merge requests found
...@@ -282,21 +282,21 @@ bool *VCSBaseClientSettings::boolPointer(const QString &key) ...@@ -282,21 +282,21 @@ bool *VCSBaseClientSettings::boolPointer(const QString &key)
QString *VCSBaseClientSettings::stringPointer(const QString &key) QString *VCSBaseClientSettings::stringPointer(const QString &key)
{ {
if (hasKey(key)) if (hasKey(key) && valueType(key) == QVariant::String)
return d->m_valueHash[key].m_comp.strPtr; return d->m_valueHash[key].m_comp.strPtr;
return 0; return 0;
} }
int VCSBaseClientSettings::intValue(const QString &key, int defaultValue) const int VCSBaseClientSettings::intValue(const QString &key, int defaultValue) const
{ {
if (hasKey(key)) if (hasKey(key) && valueType(key) == QVariant::Int)
return d->m_valueHash[key].m_comp.intValue; return d->m_valueHash[key].m_comp.intValue;
return defaultValue; return defaultValue;
} }
bool VCSBaseClientSettings::boolValue(const QString &key, bool defaultValue) const bool VCSBaseClientSettings::boolValue(const QString &key, bool defaultValue) const
{ {
if (hasKey(key)) if (hasKey(key) && valueType(key) == QVariant::Bool)
return d->m_valueHash[key].m_comp.boolValue; return d->m_valueHash[key].m_comp.boolValue;
return defaultValue; return defaultValue;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment