Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing InventoryDef.Properties throws a Null Reference Exception #747

Open
peterdwdawe opened this issue Dec 13, 2023 · 0 comments · May be fixed by #748
Open

Accessing InventoryDef.Properties throws a Null Reference Exception #747

peterdwdawe opened this issue Dec 13, 2023 · 0 comments · May be fixed by #748
Assignees

Comments

@peterdwdawe
Copy link

Describe the bug
As in title, attempting to access or iterate InventoryDef.Properties throws a NullReferenceException

To Reproduce
Steps to reproduce the behavior:

  1. Get an InventoryDef in any way
    e.g. SteamInventory.LoadItemDefinitions() followed by accessing SteamInventory.Definitions

  2. try to access Properties,
    e.g. foreach (var prop in def.Properties)

  3. See error

Calling Code
See above

Expected behavior
No error, return properties as an IEnumerable<KeyValuePair<string,string>>

Desktop (please complete the following information):

  • OS: Windows 10 64 bit
  • Unity: Unity 2019.4

Additional context
Must be tested outside the spacewar AppID, since no InventoryItems can be retrieved on 480.
Caused by a call inside Properties to GetProperty(null), where the dictionary will complain about being given a null key. I will be submitting a pull request that fixes this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants