commit 30f7af784974067f5b3191f5d7a57fb411a3d501
parent e88c2088a77917474db9466a4578b217b7ac80e2
Author: cfillion <cfillion@users.noreply.github.com>
Date: Mon, 30 Jan 2017 13:50:44 -0500
serializer: fix crash when reading empty data on macOS 10.8 [p=1794205]
I was unable to create a unit test to reproduce the bug on macOS 10.8.
It might have something to do with the locale (REAPER appears to change
it).
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/serializer.cpp b/src/serializer.cpp
@@ -17,6 +17,7 @@
#include "serializer.hpp"
+#include <boost/lexical_cast.hpp>
#include <sstream>
static const unsigned short VERSION = 1;
@@ -51,9 +52,9 @@ auto Serializer::read(const string &input, const int userVersion) -> Data
int value;
try {
- value = stoi(field.c_str());
+ value = boost::lexical_cast<int>(field);
}
- catch(logic_error &) {
+ catch(const boost::bad_lexical_cast &) {
return out; // data is invalid! aborting.
}