Skip to content

Commit

Permalink
Dereference of null pointer google#5353 (google#5376)
Browse files Browse the repository at this point in the history
add an assert to make sure that `key_field` is not a null pointer.
  • Loading branch information
QiAnXinCodeSafe authored and aardappel committed May 31, 2019
1 parent 51dd733 commit 3a88e10
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/idl_gen_general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {";
Expand Down

0 comments on commit 3a88e10

Please sign in to comment.