Fixed a bug in DewPoint decoding

This commit is contained in:
Avamander 2021-12-02 21:12:33 +02:00
parent be7931c4fb
commit 4a8f72bd1e

View file

@ -202,7 +202,7 @@ namespace Pinetime {
int64_t tmpDewPoint = 0; int64_t tmpDewPoint = 0;
QCBORDecode_GetInt64InMapSZ(&decodeContext, "DewPoint", &tmpDewPoint); QCBORDecode_GetInt64InMapSZ(&decodeContext, "DewPoint", &tmpDewPoint);
if (tmpDewPoint < 0 || tmpDewPoint > 65535) { if (tmpDewPoint < -32768 || tmpDewPoint > 32767) {
return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN; return BLE_ATT_ERR_INVALID_ATTR_VALUE_LEN;
} }
temperature->dewPoint = tmpDewPoint; // NOLINT(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions) temperature->dewPoint = tmpDewPoint; // NOLINT(bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions)