UpdateAccountAsync throwing NullReferenceException when passing null as Username parameter

According to documentation you can pass a null as a username parameter. It also worked on Nakama-Unity SDK below version 3.6.0. We updated to 3.12.0 and now we are getting NullReferenceException everytime we call the method.
As far as I understand it is supposed to take Session.Username if the passed username is null, as we pass the Session object to the method, but now it doesn’t work as expected.

As a workaround we now pass Session.Username intentionally:

await Client.UpdateAccountAsync(Session, Session.Username, displayName: someNickname);

There is no issue, it’s just that you should either return sdk behaviour to what it was before the update or just update the documentation.

Please reply if it is a desired behaviour or a bug so we could refactor code project according to new changes.

Thank you

Hello @UmarBhatPlaystrom,

Thank you for reporting, this will be fixed in the SDK.

As part of the changes introduced in the upgrade, the SDK now attempts to refresh the session token to update the username stored within it if a new username is passed as an argument, but a null argument wasn’t correctly handled.

Best.

1 Like

PR merged: Fix null argument for username in account update by sesposito · Pull Request #175 · heroiclabs/nakama-dotnet · GitHub, expect the fix to be in the next release.

1 Like