If we encounter "null" for a non-NullValue enum, throw an error.

pull/13171/head
Joshua Haberman 4 years ago
parent 0a3a94a12f
commit 7ccf5650c7
  1. 12
      upb/json_decode.c

@ -798,12 +798,14 @@ static upb_msgval jsondec_enum(jsondec *d, const upb_fielddef *f) {
return val; return val;
} }
case JD_NULL: { case JD_NULL: {
UPB_ASSERT(jsondec_isnullvalue(f)); if (jsondec_isnullvalue(f)) {
jsondec_null(d); upb_msgval val;
upb_msgval val; jsondec_null(d);
val.int32_val = 0; val.int32_val = 0;
return val; return val;
}
} }
/* Fallthrough. */
default: default:
return jsondec_int(d, f); return jsondec_int(d, f);
} }

Loading…
Cancel
Save