Mesa (master): util/hash_table: Handle NULL ht in _mesa_hash_table_clear().

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 10 22:40:06 UTC 2020


Module: Mesa
Branch: master
Commit: 9c5422c7dd6e3d272075ac3dc7e726b7764159a7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9c5422c7dd6e3d272075ac3dc7e726b7764159a7

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Oct 20 15:01:15 2020 -0700

util/hash_table: Handle NULL ht in _mesa_hash_table_clear().

This is the one useful bit of _mesa_set_clear() that wasn't in
_mesa_hash_table_clear().

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7244>

---

 src/util/hash_table.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/util/hash_table.c b/src/util/hash_table.c
index 596bab4c322..d27ba74b909 100644
--- a/src/util/hash_table.c
+++ b/src/util/hash_table.c
@@ -244,6 +244,9 @@ void
 _mesa_hash_table_clear(struct hash_table *ht,
                        void (*delete_function)(struct hash_entry *entry))
 {
+   if (!ht)
+      return;
+
    struct hash_entry *entry;
 
    for (entry = ht->table; entry != ht->table + ht->size; entry++) {



More information about the mesa-commit mailing list