aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--subhook.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/subhook.h b/subhook.h
index c74e5d1..b7934f0 100644
--- a/subhook.h
+++ b/subhook.h
@@ -145,8 +145,10 @@ class Hook {
: hook_(subhook_new(src, dst, (subhook_options_t)options)) {}
~Hook() {
- subhook_remove(hook_);
- subhook_free(hook_);
+ if (hook_ != 0) {
+ subhook_remove(hook_);
+ subhook_free(hook_);
+ }
}
void *GetSrc() { return subhook_get_src(hook_); }