[tracker/wip/carlosg/fixes-for-music] libtracker-bus: Make cursor conform to API docs
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/fixes-for-music] libtracker-bus: Make cursor conform to API docs
- Date: Sat, 17 Nov 2018 14:30:52 +0000 (UTC)
commit a0f4c09c6b077ce7b2f896da572474acc1867d12
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Nov 17 11:30:01 2018 +0100
libtracker-bus: Make cursor conform to API docs
It says "NULL is returned if column is not between [0,n_columns]",
says nothing about it being a programming error though.
src/libtracker-bus/tracker-bus-fd-cursor.vala | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-bus/tracker-bus-fd-cursor.vala b/src/libtracker-bus/tracker-bus-fd-cursor.vala
index a0e881572..d42a6133f 100644
--- a/src/libtracker-bus/tracker-bus-fd-cursor.vala
+++ b/src/libtracker-bus/tracker-bus-fd-cursor.vala
@@ -63,9 +63,14 @@ class Tracker.Bus.FDCursor : Tracker.Sparql.Cursor {
}
public override unowned string? get_string (int column, out long length = null)
- requires (column < n_columns && data != null) {
+ requires (data != null) {
unowned string str = null;
+ if (column >= n_columns) {
+ length = 0;
+ return null;
+ }
+
// return null instead of empty string for unbound values
if (types[column] == Sparql.ValueType.UNBOUND) {
length = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]