hlmod / Shop-Core

Documentation
https://hlmod.github.io/Shop-Core/module/create/
GNU General Public License v3.0
28 stars 26 forks source link

Bug. Error registering an item in a previously uploaded category. #132

Open IL0co opened 2 years ago

IL0co commented 2 years ago

Describe the bug Due to the fact that the category is badly unloaded, it deletes all handles behind itself. And if you register an item in this category again, then an error will be thrown due to invalid handles.

Module for testing. shop_test.txt

To Reproduce Steps to reproduce the behavior: 1) Reload the shop. (not necessary) 2) Load my module for testing (sm plugin load). 3) Reload the module for testing (sm plugins reload). 4) Get an error.

Server (please complete the following information):

Console Log


    # I reload the shop to clear it.
] sm plugins reload shop
[Shop] Trying to connect!
[SM] Plugin [Shop] Core reloaded successfully.
 [Shop] Ваши данные магазина были загружены! Введите в чате !shop для доступа к магазину!

    # Loading my module.
] sm plugins load shop_test
Created new category
[SM] Loaded plugin shop_test.smx successfully.
 [Shop] Ваши данные магазина были загружены! Введите в чате !shop для доступа к магазину!
    # Shop loaded normally.

    # I reload my module, the module found an already created category and tries to register an item in it and an error pops up.
] sm plugins reload shop_test
Category founded
L 04/25/2022 - 22:34:49: [SM] Exception reported: Invalid Handle 0 (error 4)
L 04/25/2022 - 22:34:49: [SM] Blaming: shop.smx
L 04/25/2022 - 22:34:49: [SM] Call stack trace:
L 04/25/2022 - 22:34:49: [SM]   [0] StringMap.GetValue
L 04/25/2022 - 22:34:49: [SM]   [1] Line 364, c:\mygithub\Shop-Core\addons\sourcemod\scripting\shop/item_manager.sp::ItemManager_StartItem
L 04/25/2022 - 22:34:49: [SM]   [3] Shop_StartItem
L 04/25/2022 - 22:34:49: [SM]   [4] Line 29, d:\scripting\shop_test.sp::Shop_Started
L 04/25/2022 - 22:34:49: [SM]   [5] Line 14, d:\scripting\shop_test.sp::OnPluginStart
[SM] Plugin shop_test.smx failed to reload: Error detected in plugin startup (see error logs).
Truyn commented 2 years ago

Да есть такая проблема