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

improve: return empty string when its size is 0 #519

Merged
merged 1 commit into from
Apr 6, 2023

Conversation

insthync
Copy link
Contributor

@insthync insthync commented Apr 5, 2023

I think it should return an empty string when its size is 0, so we won't have to check null string when reading it, but still return null when its size reached the max length so we can know error occurring because of too big string size

@RevenantX
Copy link
Owner

@insthync how do you know that it reached maxlength on receive side?

@insthync
Copy link
Contributor Author

insthync commented Apr 6, 2023

Know because it will return null (notice at line 292), but if its length is 0 it will returns string.Empty

@RevenantX
Copy link
Owner

But if it reach max size on "send" side - it will be 0 https://github.com/RevenantX/LiteNetLib/blob/master/LiteNetLib/Utils/NetDataWriter.cs#L366

@insthync
Copy link
Contributor Author

insthync commented Apr 6, 2023

Oh, I just saw that one.

Hmm, then I think it is up to how users like it, I've just upgraded from 0.9, the old one did not return null, so I change yours to return string.Empty for my convenience.

@RevenantX RevenantX merged commit 7215ed3 into RevenantX:master Apr 6, 2023
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 this pull request may close these issues.

None yet

2 participants