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

Fix byte[] nullability annotations in PersonaStateCallback #1067

Merged
merged 1 commit into from
Dec 21, 2021
Merged

Fix byte[] nullability annotations in PersonaStateCallback #1067

merged 1 commit into from
Dec 21, 2021

Conversation

JustArchi
Copy link
Contributor

@JustArchi JustArchi commented Dec 21, 2021

After recent code edit in my project I started making use of AvatarHash field in PersonaStateCallback. Despite current nullability which states that AvatarHash is non-null, my program has failed numerous times with exception similar to below:

ArchiBot|OnUnhandledException() System.NullReferenceException: Object reference not set to an instance of an object.
   at ArchiBot.Platform.Steam.SteamBot.OnPersonaState(PersonaStateCallback callback)
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__127_1(Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()

I've confirmed my theory that AvatarHash is null by ensuring that this if executes despite my IDE warning that it's always false:

obraz

I'm not sure under what exact circumstance this happens, and if it's warranted/intentional, but as it stands today the nullability is simply wrong and I'm only correcting it to what it should be to begin with. I've noticed that AvatarHash in ClanStateCallback below is correctly declared as byte[]?, therefore this could be simply annotation mistake, as the logic looks similar.

As a side note I've corrected GameDataBlob as it uses the same proto declaration and is likely also wrong.

Thank you in advance for accepting this PR.

/cc @yaakov-h @xPaw

JustArchi added a commit to JustArchiNET/ArchiSteamFarm that referenced this pull request Dec 21, 2021
@yaakov-h yaakov-h added this to the 2.5.0 milestone Dec 21, 2021
@yaakov-h yaakov-h added the bug label Dec 21, 2021
@yaakov-h yaakov-h added this to In progress in Things that need fixing via automation Dec 21, 2021
@yaakov-h yaakov-h merged commit fd4e984 into SteamRE:master Dec 21, 2021
Things that need fixing automation moved this from In progress to Done Dec 21, 2021
@JustArchi JustArchi deleted the fix-steamfriends-nullability branch December 21, 2021 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

2 participants