From da19d92f1655db5e3a711e50524cb0532b365b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Thu, 18 Feb 2010 21:28:28 +0100 Subject: [PATCH] Asserts into IFs --- library/DFHackAPI.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index 18334c2db..1739b20e1 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -907,7 +907,8 @@ bool API::InitReadNotes( uint32_t &numnotes ) } bool API::ReadNote (const int32_t &index, t_note & note) { - assert (d->notesInited); + if(!d->notesInited) + return false; // read pointer from vector at position uint32_t temp = * (uint32_t *) d->p_notes->at (index); note.symbol = g_pProcess->readByte(temp); @@ -938,7 +939,8 @@ bool API::InitReadHotkeys( ) } bool API::ReadHotkeys(t_hotkey hotkeys[]) { - assert (d->hotkeyInited); + if (!d->hotkeyInited) + return false; uint32_t currHotkey = d->hotkey_start; for(uint32_t i = 0 ; i < NUM_HOTKEYS ;i++) {