Skip to content

Commit

Permalink
pd: Use teardown in peripheral destructor only if context exists
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasva committed Sep 1, 2023
1 parent cfd81a5 commit 1f293bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/osdp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ class PeripheralDevice : public Common {
public:
PeripheralDevice()
{
_ctx = nullptr;
}

~PeripheralDevice()
{
osdp_pd_teardown(_ctx);
if (_ctx) {
osdp_pd_teardown(_ctx);
}
}

bool setup(osdp_pd_info_t *info)
Expand Down

0 comments on commit 1f293bb

Please sign in to comment.