yeganemehr / arduino-at

It's a fully async library for communicate with AT modems.
MIT License
0 stars 1 forks source link

Passing String::substring as reference #2

Closed GiPe66 closed 1 year ago

GiPe66 commented 1 year ago

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 commented 1 year ago

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.