[tracker/direct-access: 67/121] libtracker-bus: Make sure current_row is set to -1 and next() is always required



commit 18e29f759785ff124136bc5a5ccddd2d49bae2f1
Author: Martyn Russell <martyn lanedo com>
Date:   Mon Jul 19 15:19:21 2010 +0100

    libtracker-bus: Make sure current_row is set to -1 and next() is always required

 src/libtracker-bus/tracker-array-cursor.vala |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-bus/tracker-array-cursor.vala b/src/libtracker-bus/tracker-array-cursor.vala
index d82b5cd..99abf86 100644
--- a/src/libtracker-bus/tracker-array-cursor.vala
+++ b/src/libtracker-bus/tracker-array-cursor.vala
@@ -19,7 +19,7 @@
 
 internal class Tracker.Bus.ArrayCursor : Tracker.Sparql.Cursor {
 	int rows;
-	int current_row;
+	int current_row = -1;
 	char **results;
 	int cols;
 
@@ -31,7 +31,8 @@ internal class Tracker.Bus.ArrayCursor : Tracker.Sparql.Cursor {
 
 	public override int n_columns { get { return cols; } }
 
-	public override unowned string? get_string (int column, out long length = null) {
+	public override unowned string? get_string (int column, out long length = null)
+	requires (current_row >= 0) {
 		char **row;
 		unowned string str;
 
@@ -40,7 +41,7 @@ internal class Tracker.Bus.ArrayCursor : Tracker.Sparql.Cursor {
 		}
 
 		row = results + current_row;
-		str =  (string) row[column];
+		str = (string) row[column];
 
 		if (&length != null) {
 			length = str.length;



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