aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/hash.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c
index 08c64568c83..7c3c7a6bdbb 100644
--- a/src/mesa/main/hash.c
+++ b/src/mesa/main/hash.c
@@ -191,10 +191,12 @@ _mesa_HashInsert(struct _mesa_HashTable *table, GLuint key, void *data)
/* alloc and insert new table entry */
entry = MALLOC_STRUCT(HashEntry);
- entry->Key = key;
- entry->Data = data;
- entry->Next = table->Table[pos];
- table->Table[pos] = entry;
+ if (entry) {
+ entry->Key = key;
+ entry->Data = data;
+ entry->Next = table->Table[pos];
+ table->Table[pos] = entry;
+ }
_glthread_UNLOCK_MUTEX(table->Mutex);
}