TavstalDev / TShop2

SQL based async item and vehicle shop plugin for Unturned 3
GNU General Public License v3.0
3 stars 0 forks source link

Purchases were not possible on the UI and a new error popped up on the console. #3

Closed TavstalDev closed 3 months ago

TavstalDev commented 3 months ago
          @TavstalDev  Purchases were not possible on the UI and a new error popped up on the console.
[TShop] [EXCEPTION] > Error in UEventHandler -> OnButtonClick(bt_tshop_basket#buy):
[TShop] [ERROR] > System.NullReferenceException: Object reference not set to an instance of an object
  at Tavstal.TShop.Compability.Hooks.UconomyHook.GetBalanceAsync (Steamworks.CSteamID player, Tavstal.TLibrary.Compatibility.Economy.EPaymentMethod method) [0x0003f] in <116d602619744bf3b363c48ef3e0d31b>:0
  at Tavstal.TShop.Handlers.UnturnedEventHandler.Event_OnButtonClick (SDG.Unturned.Player player, System.String button) [0x00e5e] in <116d602619744bf3b363c48ef3e0d31b>:0

Originally posted by @CatzMR in https://github.com/TavstalDev/TShop2/issues/1#issuecomment-2134578750

CatzMR commented 3 months ago

@TavstalDev The problem still exists.

[TShop] [EXCEPTION] > Error in UEventHandler -> OnButtonClick(bt_tshop_basket#buy):
[TShop] [ERROR] > System.NullReferenceException: Object reference not set to an instance of an object
  at Tavstal.TShop.Compability.Hooks.UconomyHook+<>cDisplayClass20_0.<GetBalanceAsync>b0 () [0x00031] in <9c6ef40d0e444837bce4e7e723f9c8e6>:0
--- End of stack trace from previous location where exception was thrown ---

  at Tavstal.TShop.Compability.Hooks.UconomyHook.GetBalanceAsync (Steamworks.CSteamID player, Tavstal.TLibrary.Compatibility.Economy.EPaymentMethod method) [0x0012c] in <9c6ef40d0e444837bce4e7e723f9c8e6>:0
  at Tavstal.TShop.Handlers.UnturnedEventHandler.Event_OnButtonClick (SDG.Unturned.Player player, System.String button) [0x011d8] in <9c6ef40d0e444837bce4e7e723f9c8e6>:0

Error on the console when trying to purchase using the UI.

NullReferenceException: Object reference not set to an instance of an object
  at Tavstal.TShop.Compability.Hooks.UconomyHook+<>cDisplayClass20_0.<GetBalanceAsync>b0 () [0x00031] in <9c6ef40d0e444837bce4e7e723f9c8e6>:0
--- End of stack trace from previous location where exception was thrown ---

  at Tavstal.TShop.Compability.Hooks.UconomyHook.GetBalanceAsync (Steamworks.CSteamID player, Tavstal.TLibrary.Compatibility.Economy.EPaymentMethod method) [0x0012c] in <9c6ef40d0e444837bce4e7e723f9c8e6>:0
  at Tavstal.TShop.CommandBuyItem.Execute (Rocket.API.IRocketPlayer caller, System.String[] args) [0x0029f] in <9c6ef40d0e444837bce4e7e723f9c8e6>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in <47fc8c70fa834cbf8141d7c1a7589125>:0
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00002] in <fcaf289839f24125a059795f150fce14>:0
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00056] in <fcaf289839f24125a059795f150fce14>:0
  at UnityEngine.UnitySynchronizationContext.ExecuteTasks () [0x00014] in <fcaf289839f24125a059795f150fce14>:0

Error in the console when using the /buy command to purchase.

TavstalDev commented 3 months ago

The issue: Wrong type was used to get Uconomy's Database methods Fix: Replace the wrong type with the type of uconomy's database.

Uploaded the fixed version.