From b87db071523a20af9ccee157ebe520e76089e24f Mon Sep 17 00:00:00 2001 From: Nik Bougalis Date: Sat, 4 Oct 2014 14:38:37 -0700 Subject: [PATCH] Avoid dereferencing a null field --- utilities/document/document_db.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/document/document_db.cc b/utilities/document/document_db.cc index b19618533..6540c2d8c 100644 --- a/utilities/document/document_db.cc +++ b/utilities/document/document_db.cc @@ -385,13 +385,13 @@ class SimpleSortedIndex : public Index { override { auto value = document.Get(field_); if (value == nullptr) { - // null if (!EncodeJSONPrimitive(JSONDocument(JSONDocument::kNull), key)) { assert(false); } - } - if (!EncodeJSONPrimitive(*value, key)) { - assert(false); + } else { + if (!EncodeJSONPrimitive(*value, key)) { + assert(false); + } } } virtual const Comparator* GetComparator() const override {