goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
130 stars 69 forks source link

ControlPanel destructor gives teardown error when not initiated #129

Closed niklasva closed 11 months ago

niklasva commented 11 months ago

When the ControlPanel desctructor is called before cp has been set up, the application will fail and give an assertion error:

assertion "TO_OSDP(ctx)->_magic == OSDP_CTX_MAGIC" failed: file "osdp_cp.c", line 1329, function: osdp_cp_teardown

I understand that this error is because of the context not existing yet when the teardown happens, but I don't think that this should be an issue in the case of just destroying a control panel object that for one reason or another hasn't been set up.