forked from qt-creator/qt-creator
VcsBaseClientSetting, check the type before returning from the union
Change-Id: Ic40b88e1cf9b731509edc6636c1e0bdb5f053529 Reviewed-on: http://codereview.qt-project.org/6234 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -282,21 +282,21 @@ bool *VCSBaseClientSettings::boolPointer(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 0;
|
||||
}
|
||||
|
||||
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 defaultValue;
|
||||
}
|
||||
|
||||
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 defaultValue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user