diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-04-15 21:09:35 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-04-15 21:09:35 +0100 |
commit | 58ed7953ef439d242c4822f837ed745c6869f761 (patch) | |
tree | 64bf62f73f6713dac55b18e6910993694ea9e38e /test/rspamd_cxx_unit_dkim.hxx | |
parent | 1d32119e301d0507050d28e232669832715a75c6 (diff) | |
download | rspamd-58ed7953ef439d242c4822f837ed745c6869f761.tar.gz rspamd-58ed7953ef439d242c4822f837ed745c6869f761.zip |
[Test] Do not cause sigsegv on failed test
Diffstat (limited to 'test/rspamd_cxx_unit_dkim.hxx')
-rw-r--r-- | test/rspamd_cxx_unit_dkim.hxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/rspamd_cxx_unit_dkim.hxx b/test/rspamd_cxx_unit_dkim.hxx index 29facba8a..802e9ecbf 100644 --- a/test/rspamd_cxx_unit_dkim.hxx +++ b/test/rspamd_cxx_unit_dkim.hxx @@ -150,11 +150,15 @@ TEST_CASE("rspamd_dkim_parse_key") CHECK(key != nullptr); char hexbuf[RSPAMD_DKIM_KEY_ID_LEN * 2 + 1]; auto *id = rspamd_dkim_key_id(key); - auto hexlen = rspamd_encode_hex_buf(id, RSPAMD_DKIM_KEY_ID_LEN, hexbuf, - sizeof(hexbuf)); - CHECK(hexlen > 0); - CHECK(std::string{hexbuf, (std::size_t) hexlen} == c.expected_id); - rspamd_dkim_key_free(key); + CHECK(id != nullptr); + + if (id) { + auto hexlen = rspamd_encode_hex_buf(id, RSPAMD_DKIM_KEY_ID_LEN, hexbuf, + sizeof(hexbuf)); + CHECK(hexlen > 0); + CHECK(std::string{hexbuf, (std::size_t) hexlen} == c.expected_id); + rspamd_dkim_key_free(key); + } } else { CHECK(key == nullptr); |