From 780a0d771edbe21dcfa3405163ffbdf7f7fa4604 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Mon, 13 Oct 2014 13:16:34 -0700 Subject: Convert container lookups to use Option> --- src/login/login.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/login/login.cpp') diff --git a/src/login/login.cpp b/src/login/login.cpp index ccb68fc..a84c96a 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -231,6 +231,7 @@ AString gm_pass; static GmLevel level_new_gm = GmLevel::from(60u); +// TODO make this just be Map static Map gm_account_db; @@ -287,10 +288,8 @@ void delete_admin(Session *s) static GmLevel isGM(AccountId account_id) { - GM_Account *p = gm_account_db.search(account_id); - if (p == nullptr) - return GmLevel(); - return p->level; + Option> p = gm_account_db.search(account_id); + return TRY_UNWRAP(p, return GmLevel())->level; } //------------------------------------------------------- -- cgit v1.2.3-60-g2f50