From 70690f712e7d5eeeaf7c16c6a1ebec2f197f5006 Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Thu, 28 Sep 2023 17:54:12 +0100 Subject: [PATCH] fix: was incorrectly getting roles/id's from null --- src/lib.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index ebb7c2a..11f65fd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -136,7 +136,11 @@ impl<'r> FromRow<'r, SqliteRow> for ServerMembersWolves { let discord = match row.try_get("discord") { Ok(x) => { let tmp: i64 = x; - Some(UserId::from(tmp as u64)) + if tmp == 0 { + None + } else { + Some(UserId::from(tmp as u64)) + } } _ => None, }; @@ -164,7 +168,11 @@ impl<'r> FromRow<'r, SqliteRow> for Wolves { let discord = match row.try_get("discord") { Ok(x) => { let tmp: i64 = x; - Some(UserId::from(tmp as u64)) + if tmp == 0 { + None + } else { + Some(UserId::from(tmp as u64)) + } } _ => None, }; @@ -215,14 +223,22 @@ impl<'r> FromRow<'r, SqliteRow> for Servers { let role_past = match row.try_get("role_past") { Ok(x) => { let tmp: i64 = x; - Some(RoleId::from(tmp as u64)) + if tmp == 0 { + None + } else { + Some(RoleId::from(tmp as u64)) + } } _ => None, }; let role_current = match row.try_get("role_current") { Ok(x) => { let tmp: i64 = x; - Some(RoleId::from(tmp as u64)) + if tmp == 0 { + None + } else { + Some(RoleId::from(tmp as u64)) + } } _ => None, };