From 7a3219cb97e70ddfca6119596861928249318e4e Mon Sep 17 00:00:00 2001 From: Slider0007 <115730895+Slider0007@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:12:16 +0200 Subject: [PATCH] fix(load fallbackvalue): Avoid conversion exception if string is invalid (#169) --- code/components/mainprocess_ctrl/ClassFlowPostProcessing.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/components/mainprocess_ctrl/ClassFlowPostProcessing.cpp b/code/components/mainprocess_ctrl/ClassFlowPostProcessing.cpp index aa8f6d35f..94e8c2b81 100644 --- a/code/components/mainprocess_ctrl/ClassFlowPostProcessing.cpp +++ b/code/components/mainprocess_ctrl/ClassFlowPostProcessing.cpp @@ -844,7 +844,8 @@ bool ClassFlowPostProcessing::loadFallbackValue(void) // Fallback value valid else { sequence->isFallbackValueValid = true; - sequence->fallbackValue = stod(std::string(cValue)); + char *pEnd = NULL; + sequence->fallbackValue = strtod(cValue, &pEnd); sequence->sFallbackValue = to_stringWithPrecision(sequence->fallbackValue, sequence->decimalPlaceCount + 1); // Keep one digit more LogFile.writeToFile(ESP_LOG_INFO, TAG, sequence->sequenceName + ": Fallback value valid | Time: " + std::string(cTime)); }