From 182f33f8ae8c3579e098d915d00ad02bb77106fb Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Mon, 23 May 2016 18:54:18 +0100 Subject: [PATCH] Complete fixes for olm_*_last_error Should have been in the previous commit :/ --- src/olm.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/olm.cpp b/src/olm.cpp index 15c5e83..4e5f215 100644 --- a/src/olm.cpp +++ b/src/olm.cpp @@ -202,7 +202,7 @@ const char * olm_session_last_error( OlmSession * session ) { unsigned error = unsigned(from_c(session)->last_error); - if (error < sizeof(ERRORS)) { + if (error < (sizeof(ERRORS)/sizeof(ERRORS[0]))) { return ERRORS[error]; } else { return "UNKNOWN_ERROR"; @@ -213,7 +213,7 @@ const char * olm_utility_last_error( OlmUtility * utility ) { unsigned error = unsigned(from_c(utility)->last_error); - if (error < sizeof(ERRORS)) { + if (error < (sizeof(ERRORS)/sizeof(ERRORS[0]))) { return ERRORS[error]; } else { return "UNKNOWN_ERROR";