commit | 27f8d367d3c6a6df134bd062ce43bd2435041c8a | [log] [tgz] |
---|---|---|
author | Eric Salo <salo@google.com> | Wed Sep 07 21:44:48 2022 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Wed Sep 07 21:45:32 2022 -0700 |
tree | a2bfe1240fae03b6fd8a2f4a761b280f9134e335 | |
parent | 467e2b5e3b41d6822a8ebbda313d54bc12b8c584 [diff] [blame] |
fix segfault when clearing an unset oneof in Python https://github.com/protocolbuffers/protobuf/issues/10461 PiperOrigin-RevId: 472891559
diff --git a/python/message.c b/python/message.c index 47b00e8..e67bf23 100644 --- a/python/message.c +++ b/python/message.c
@@ -1361,7 +1361,7 @@ } if (o) f = upb_Message_WhichOneof(self->ptr.msg, o); - PyUpb_Message_DoClearField(_self, f); + if (f) PyUpb_Message_DoClearField(_self, f); Py_RETURN_NONE; }