From c726506b4744ee3f13fc0f2a4082c18954537904 Mon Sep 17 00:00:00 2001 From: Benoit Blanchon Date: Sat, 20 Dec 2014 15:15:41 +0100 Subject: [PATCH] Added std::nothrow --- include/ArduinoJson/DynamicJsonBuffer.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/ArduinoJson/DynamicJsonBuffer.hpp b/include/ArduinoJson/DynamicJsonBuffer.hpp index 16b7626c..919968ad 100644 --- a/include/ArduinoJson/DynamicJsonBuffer.hpp +++ b/include/ArduinoJson/DynamicJsonBuffer.hpp @@ -53,7 +53,10 @@ class DynamicJsonBuffer : public JsonBuffer { } void* allocInOtherBlocks(size_t bytes) { - if (!_next) _next = new DynamicJsonBuffer(); + if (!_next) { + _next = new (std::nothrow) DynamicJsonBuffer(); + if (!_next) return NULL; + } return _next->alloc(bytes); }