From bf12ed4c4716a7a4d12b27cf6135d7a1faa34197 Mon Sep 17 00:00:00 2001 From: gsemaj Date: Sat, 1 May 2021 20:50:48 -0400 Subject: [PATCH] Fix patcher refusing to patch between unsigned and signed integers --- src/TableData.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/TableData.cpp b/src/TableData.cpp index 3c958d0..4f8255c 100644 --- a/src/TableData.cpp +++ b/src/TableData.cpp @@ -941,8 +941,12 @@ static void patchJSON(json* base, json* patch) { if (patch->is_null() || base->is_null()) return; // no nulls allowed!! - if ((json::value_t)*base != (json::value_t)*patch) - return; // no type mismatch allowed!! + if ((json::value_t)(*base) != (json::value_t)(*patch)) { + // verify type mismatch. unsigned <-> integer is ok. + if (!((base->is_number_integer() && patch->is_number_unsigned()) + || (base->is_number_unsigned() && patch->is_number_integer()))) + return; + } // case 1: type is array if (patch->is_array()) {