Fix crash on broken documents
Bug #101505
diff --git a/goo/GooHash.cc b/goo/GooHash.cc
index f4a92f1..49f58c5 100644
--- a/goo/GooHash.cc
+++ b/goo/GooHash.cc
@@ -6,6 +6,20 @@
//
//========================================================================
+//========================================================================
+//
+// Modified under the Poppler project - http://poppler.freedesktop.org
+//
+// All changes made under the Poppler project to this file are licensed
+// under GPL version 2 or later
+//
+// Copyright (C) 2017 Albert Astals Cid <aacid@kde.org>
+//
+// To see a description of the changes please see the Changelog file that
+// came with your tarball or type make ChangeLog if you are building from git
+//
+//========================================================================
+
#include <config.h>
#ifdef USE_GCC_PRAGMAS
@@ -15,6 +29,7 @@
#include "gmem.h"
#include "GooString.h"
#include "GooHash.h"
+#include "GooLikely.h"
//------------------------------------------------------------------------
@@ -339,6 +354,9 @@
GooHashBucket *GooHash::find(GooString *key, int *h) {
GooHashBucket *p;
+ if (unlikely(!key))
+ return nullptr;
+
*h = hash(key);
for (p = tab[*h]; p; p = p->next) {
if (!p->key->cmp(key)) {