Describe the bug
stopping the server with MBserver.stop() cause crash if the server is not running.
Please add a check to be sure the server is running before trying to stop it.
I fixed by myself adding this in the file ModbusServerTCPasync.cpp:
bool ModbusServerTCPasync::stop() {
// required check!!!
if (!server) {
LOG_W("Server not running.\n");
return false;
}
// stop server to prevent new clients connecting
server->end();
......
Expected behavior
stop() should return false if server it's not running and not crash.
To Reproduce
Steps to reproduce the behavior:
stop the server when it's not running using the MBserver.stop() function
Describe the bug stopping the server with MBserver.stop() cause crash if the server is not running.
Please add a check to be sure the server is running before trying to stop it. I fixed by myself adding this in the file ModbusServerTCPasync.cpp:
Expected behavior stop() should return false if server it's not running and not crash.
To Reproduce Steps to reproduce the behavior: stop the server when it's not running using the MBserver.stop() function