From 1728d47aaf293529d2e8b9bed908141079581435 Mon Sep 17 00:00:00 2001 From: kye Date: Sun, 8 Sep 2024 19:13:53 +1000 Subject: [PATCH] Fixed GetPrices Api from trying to order a null value --- Eco.EM.Framework/API/Requests.cs | 2 +- Eco.EM.Framework/Utils/ShopUtils.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Eco.EM.Framework/API/Requests.cs b/Eco.EM.Framework/API/Requests.cs index 85b4642..0726ed8 100644 --- a/Eco.EM.Framework/API/Requests.cs +++ b/Eco.EM.Framework/API/Requests.cs @@ -42,7 +42,7 @@ public string GetPrices([FromQuery]bool includeOutOfStock = false) string noResult = "No Items Found"; if (BasePlugin.Obj.Config.EnableWebAPI) { - var result = ShopUtils.GetAllItems(includeOutOfStock).OrderBy(o => o.StoreName); + var result = ShopUtils.GetAllItems(includeOutOfStock); if (result is null) return noResult; else diff --git a/Eco.EM.Framework/Utils/ShopUtils.cs b/Eco.EM.Framework/Utils/ShopUtils.cs index fe1e1e9..215cd88 100644 --- a/Eco.EM.Framework/Utils/ShopUtils.cs +++ b/Eco.EM.Framework/Utils/ShopUtils.cs @@ -197,7 +197,10 @@ public static List GetAllItems(bool includeOutOfStock = false) } } if (Items.Count > 0) + { + Items.OrderBy(o => o.StoreName); return Items; + } else return null; }