From 44d0e7a48f8a717112a03290673c4bde6976da1a Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 20 Jan 2014 21:26:12 +0100 Subject: [PATCH] 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. --- src/core/AutomatableModel.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/core/AutomatableModel.cpp b/src/core/AutomatableModel.cpp index 895e2342d..be79d973a 100644 --- a/src/core/AutomatableModel.cpp +++ b/src/core/AutomatableModel.cpp @@ -1,7 +1,7 @@ /* * AutomatableModel.cpp - some implementations of AutomatableModel-class * - * Copyright (c) 2008-2012 Tobias Doerffel + * Copyright (c) 2008-2014 Tobias Doerffel * * 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(); + } }