summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2022-12-18 13:12:41 -0300
committerSoniEx2 <endermoneymod@gmail.com>2022-12-18 13:12:41 -0300
commitd049be950cfaca6311b575890e81521d62db68d7 (patch)
tree8d31fc0502320e37b189535ec3d004e911b31e5f
parentdf9dc2cb77720b9b78ad87559657c14874d0b676 (diff)
Warn of plugin bugs
-rw-r--r--src/common/plugin.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/common/plugin.c b/src/common/plugin.c
index e15e94bb..5524e984 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c
@@ -612,6 +612,9 @@ plugin_hook_run (session *sess, char *name, char *word[], char *word_eol[],
 			break;
 		}
 
+		if ((ret & mask) != ret) {
+			g_critical("plugin tried to eat cleanup hooks");
+		}
 		ret &= mask;
 
 		if ((ret & HEXCHAT_EAT_HEXCHAT) && (ret & HEXCHAT_EAT_PLUGIN))
@@ -1151,12 +1154,16 @@ hexchat_get_context (hexchat_plugin *ph)
 int
 hexchat_set_context (hexchat_plugin *ph, hexchat_context *context)
 {
-	if (is_session (context))
+	if (context == NULL) {
+		return 0;
+	}
+	if (!is_session (context))
 	{
-		ph->context = context;
-		return 1;
+		g_critical("plugin tried to set an invalid context");
+		return 0;
 	}
-	return 0;
+	ph->context = context;
+	return 1;
 }
 
 hexchat_context *