From 1084b71d8d353c60601a5aac27e2ebbddd0cdaa8 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 8 Jun 2019 17:07:41 -0400 Subject: [PATCH] Use SQL to fix null --- world/shared_tasks.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/world/shared_tasks.cpp b/world/shared_tasks.cpp index 70db909de..65efb53e0 100644 --- a/world/shared_tasks.cpp +++ b/world/shared_tasks.cpp @@ -404,11 +404,11 @@ bool SharedTaskManager::LoadSharedTaskState() // But the crash case may actually dictate we should :P // set next_id to highest used ID - query = "SELECT MAX(id) FROM shared_task_state"; + query = "SELECT IFNULL(MAX(id), 0) FROM shared_task_state"; results = database.QueryDatabase(query); if (results.Success() && results.RowCount() == 1) { auto row = results.begin(); - next_id = row[0] ? atoi(row[0]) : 0; + next_id = atoi(row[0]); } else { next_id = 0; // oh well }