summaryrefslogtreecommitdiff
path: root/src/idl_gen_general.cpp
diff options
context:
space:
mode:
author360 CodeSafe <39950310+360CodeSafe@users.noreply.github.com>2019-05-31 08:50:21 +0800
committerWouter van Oortmerssen <aardappel@gmail.com>2019-05-30 17:50:21 -0700
commit3a88e1031be9ad97459c4de4f77319e19cbb648d (patch)
treef2ba0585a5207d823fac3ebca34889f2cfd3cb9f /src/idl_gen_general.cpp
parent51dd733ba4ec5f7504b80292c61d58cca4868c1d (diff)
downloadflatbuffers-3a88e1031be9ad97459c4de4f77319e19cbb648d.tar.gz
flatbuffers-3a88e1031be9ad97459c4de4f77319e19cbb648d.tar.bz2
flatbuffers-3a88e1031be9ad97459c4de4f77319e19cbb648d.zip
Dereference of null pointer #5353 (#5376)
add an assert to make sure that `key_field` is not a null pointer.
Diffstat (limited to 'src/idl_gen_general.cpp')
-rw-r--r--src/idl_gen_general.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/idl_gen_general.cpp b/src/idl_gen_general.cpp
index ddaae8f4..4e1be8b2 100644
--- a/src/idl_gen_general.cpp
+++ b/src/idl_gen_general.cpp
@@ -1450,6 +1450,7 @@ class GeneralGenerator : public BaseGenerator {
// Only generate key compare function for table,
// because `key_field` is not set for struct
if (struct_def.has_key && !struct_def.fixed) {
+ FLATBUFFERS_ASSERT(key_field);
if (lang_.language == IDLOptions::kJava) {
code += "\n @Override\n protected int keysCompare(";
code += "Integer o1, Integer o2, ByteBuffer _bb) {";