simonvetter / modbus

Go modbus stack (client and server)
MIT License
280 stars 89 forks source link

[Fix]: Add nil check in client.Close #36

Closed NiklasCi closed 3 weeks ago

NiklasCi commented 1 year ago

This PR checks if the transport is not nil before closing it in client.Close(). This avoid panics.

dtext commented 4 weeks ago

We extensively use the modbus stack in our go application with reconnect functionality around it and came across this same issue. We could easily solve it by making a simple change to our state machine to avoid this being called. So this may not be an issue that pops up frequently, but I agree that it's a simple thing to do that isn't wrong and simplifies usage a bit.

simonvetter commented 3 weeks ago

Fixed in v1.6.3, thanks!

NiklasCi commented 3 weeks ago

Fixed in v1.6.3, thanks!

Really appreciate taking the time for a new release. Thanks alot.