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

Passing String::substring as reference #2

Closed
GiPe66 opened this issue Sep 5, 2023 · 1 comment
Closed

Passing String::substring as reference #2

GiPe66 opened this issue Sep 5, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@GiPe66
Copy link

GiPe66 commented Sep 5, 2023

bool ATConnection::parseNotification() noexcept
{
auto pos = buffer.indexOf('\n');
if (pos < 0)
{
return false;
}
ATNotificationEvent event(buffer.substring(0, pos - 1));
this->emit(&event);
buffer.remove(0, pos + 1);
return true;
}

buffer.substring is a temporary object and the reference to it is lost.

@yeganemehr
Copy link
Owner

Hi @GiPe66
I Fixed this and just released a new version (v0.2.1).
Thank you for your contribution.
If you encounter any other problems please don't hesitate to report it.

@yeganemehr yeganemehr added the bug Something isn't working label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants