]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Avoid dereferencing a null field
authorNik Bougalis <nikb@bougalis.net>
Sat, 4 Oct 2014 21:38:37 +0000 (14:38 -0700)
committerNik Bougalis <nikb@bougalis.net>
Tue, 7 Oct 2014 08:40:29 +0000 (01:40 -0700)
utilities/document/document_db.cc

index b19618533ac0bb952331f27bc5b90eedf6ea4d0f..6540c2d8c95e4623da19364c54561f43509a8363 100644 (file)
@@ -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 {