Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ef597e1

Browse files
aentingermattiabertorello
authored andcommittedFeb 5, 2019
Bugfix: Parsing BaseTime regardless if its a double or an int
1 parent 3374ec1 commit ef597e1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed
 

‎ArduinoCloudThing.cpp

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,20 @@ ArduinoCloudThing::MapParserState ArduinoCloudThing::handle_BaseTime(CborValue *
300300
double val = 0.0;
301301
if(cbor_value_get_double(value_iter, &val) == CborNoError) {
302302
map_data->base_time.set(val);
303-
if(cbor_value_advance(value_iter) == CborNoError) {
304-
next_state = MapParserState::MapKey;
305-
}
306303
}
307304
}
308305

306+
if(cbor_value_is_integer(value_iter)) {
307+
int val = 0;
308+
if(cbor_value_get_int(value_iter, &val) == CborNoError) {
309+
map_data->base_time.set(static_cast<double>(val));
310+
}
311+
}
312+
313+
if(cbor_value_advance(value_iter) == CborNoError) {
314+
next_state = MapParserState::MapKey;
315+
}
316+
309317
return next_state;
310318
}
311319

0 commit comments

Comments
 (0)
Please sign in to comment.