[libdazzle] shortcuts: re-allow NULL tables with iters



commit dfe681de97b6bdd304347bbd52e8ece642e3a69b
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jun 12 18:54:31 2017 -0700

    shortcuts: re-allow NULL tables with iters
    
    This was convenience to allow usage from other places without NULL checking
    so we need to add this back.

 src/shortcuts/dzl-shortcut-chord.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/shortcuts/dzl-shortcut-chord.c b/src/shortcuts/dzl-shortcut-chord.c
index 9e92f0e..6b8a7c4 100644
--- a/src/shortcuts/dzl-shortcut-chord.c
+++ b/src/shortcuts/dzl-shortcut-chord.c
@@ -630,7 +630,13 @@ _dzl_shortcut_chord_table_iter_next (DzlShortcutChordTableIter  *iter,
                                      gpointer                   *value)
 {
   g_return_val_if_fail (iter != NULL, FALSE);
-  g_return_val_if_fail (iter->table != NULL, FALSE);
+
+  /*
+   * Be safe against NULL tables which we allow in
+   * _dzl_shortcut_chord_table_iter_init() for convenience.
+   */
+  if (iter->table == NULL)
+    return FALSE;
 
   if (iter->position < iter->table->len)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]