summary refs log tree commit diff
path: root/networks.c
diff options
context:
space:
mode:
Diffstat (limited to 'networks.c')
-rw-r--r--networks.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/networks.c b/networks.c
index 74b9ea2..4fcd476 100644
--- a/networks.c
+++ b/networks.c
@@ -57,6 +57,7 @@ enum kcgi_err pageNetworks(struct kreq *req) {
 		|| htmlNav(&html, scope);
 	if (error) return error;
 
+	sqlite3_reset(stmt.networks);
 	dbBindInt(stmt.networks, ":recent", pageRecent);
 
 	enum State {
@@ -68,8 +69,9 @@ enum kcgi_err pageNetworks(struct kreq *req) {
 
 	int result;
 	while (SQLITE_ROW == (result = sqlite3_step(stmt.networks))) {
-		const char *network = (const char *)sqlite3_column_text(stmt.networks, 0);
-		bool active = sqlite3_column_int(stmt.networks, 1);
+		int i = 0;
+		const char *network = sqlite3_column_text(stmt.networks, i++);
+		bool active = sqlite3_column_int(stmt.networks, i++);
 
 		enum State prev = state;
 		state = (active ? Active : Networks);
@@ -98,9 +100,5 @@ enum kcgi_err pageNetworks(struct kreq *req) {
 		if (error) break;
 	}
 	if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));
-	sqlite3_reset(stmt.networks);
-
-	return error
-		|| htmlFooter(&html)
-		|| khtml_close(&html);
+	return error || htmlFooter(&html) || khtml_close(&html);
 }