[tracker/wip/carlosg/fixes-for-music: 1/2] libtracker-data: Fix crash on unbound variables in ORDER BY



commit 5dd0c7cfaa0a133fc8c322b1071f3ca783056998
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 15 12:51:45 2018 +0100

    libtracker-data: Fix crash on unbound variables in ORDER BY
    
    Unbound variables are unexpected/meaningless here, the spec says
    nothing about raising errors though, and other SPARQL engines seem
    to agree about it being a no-op. So just go with it and avoid
    the crash.

 src/libtracker-data/tracker-sparql.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index a45eb4a17..4f3c39b1a 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -2408,7 +2408,8 @@ translate_OrderCondition (TrackerSparql  *sparql,
                _append_variable_sql (sparql, variable);
 
                binding = tracker_variable_get_sample_binding (variable);
-               sparql->current_state.expression_type = TRACKER_BINDING (binding)->data_type;
+               if (binding)
+                       sparql->current_state.expression_type = TRACKER_BINDING (binding)->data_type;
        } else {
                g_assert_not_reached ();
        }


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