From 0936e1ca8490ddf3a58ae93397821b88c1f33844 Mon Sep 17 00:00:00 2001 From: Mansard <nmansard@laas.fr> Date: Mon, 17 Jan 2011 15:45:23 +0100 Subject: [PATCH] Corrected a warning uninitialized value. --- src/command/value.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/command/value.cpp b/src/command/value.cpp index 6632472..bb13773 100644 --- a/src/command/value.cpp +++ b/src/command/value.cpp @@ -222,21 +222,21 @@ namespace dynamicgraph { float Value::floatValue() const { float result; - if(type_ == FLOAT) - result = *((float*)value_); + if(FLOAT != type_) + throw ExceptionAbstract(ExceptionAbstract::TOOLS, + "value is not a float"); + result = *((float*)value_); return result; - throw ExceptionAbstract(ExceptionAbstract::TOOLS, - "value is not a float"); } double Value::doubleValue() const { double result; - if(type_ == DOUBLE) - result = *((double*)value_); + if(DOUBLE != type_) + throw ExceptionAbstract(ExceptionAbstract::TOOLS, + "value is not a double"); + result = *((double*)value_); return result; - throw ExceptionAbstract(ExceptionAbstract::TOOLS, - "value is not a double"); } std::string Value::stringValue() const -- GitLab