From 0a6c1c40945120d967638eee60f9941bd8777783 Mon Sep 17 00:00:00 2001 From: Chris Rybicki Date: Thu, 8 Feb 2024 12:13:44 -0500 Subject: [PATCH] fix: logic error (#30) --- dynamodb.w | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dynamodb.w b/dynamodb.w index 476ae9a..bc5334a 100644 --- a/dynamodb.w +++ b/dynamodb.w @@ -101,10 +101,13 @@ pub class DynamoDBTableAws { DynamoDBTableAws._putItem(this.tableName, json); } - pub inflight getItem(key: Map): Map { + pub inflight getItem(key: Map): Map? { let json = this._itemToJson(key); let result = DynamoDBTableAws._getItem(this.tableName, json); - return this._rawMapToItem((result ?? {}).get("Item")); + if let res = result { + return this._rawMapToItem(res.get("Item")); + } + return nil; } pub inflight scan(): Array> {