AutomatableModel: reset value to default if data is unavailable in loadSettings()

When loading older projects where a particular model did not exist and
thus did not save any data do not load the possibly invalid default data
but reset to default value of model.
This commit is contained in:
Tobias Doerffel
2014-01-20 21:26:12 +01:00
parent f8a1ffccb0
commit 44d0e7a48f

View File

@@ -1,7 +1,7 @@
/*
* AutomatableModel.cpp - some implementations of AutomatableModel-class
*
* Copyright (c) 2008-2012 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2008-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -169,7 +169,14 @@ void AutomatableModel::loadSettings( const QDomElement & _this,
}
}
setInitValue( _this.attribute( _name ).toFloat() );
if( _this.hasAttribute( _name ) )
{
setInitValue( _this.attribute( _name ).toFloat() );
}
else
{
reset();
}
}