From 7bb815a540e6c9a2e8c7be788d853771d7c7af45 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sun, 16 Oct 2005 15:39:20 +0000 Subject: [PATCH] Fixed but when no parameter given for /perl and /python options --- src/plugins/scripts/perl/weechat-perl.c | 13 +++++++++++-- src/plugins/scripts/python/weechat-python.c | 13 +++++++++++-- weechat/src/plugins/scripts/perl/weechat-perl.c | 13 +++++++++++-- weechat/src/plugins/scripts/python/weechat-python.c | 13 +++++++++++-- 4 files changed, 44 insertions(+), 8 deletions(-) diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index 504a0a596..543c39ba5 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -531,7 +531,13 @@ weechat_perl_cmd (t_weechat_plugin *plugin, (void) handler_args; (void) handler_pointer; - argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + if (arguments) + argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + else + { + argv = NULL; + argc = 0; + } switch (argc) { @@ -639,7 +645,10 @@ weechat_perl_cmd (t_weechat_plugin *plugin, plugin->printf_server (plugin, "Perl error: wrong argument count for \"perl\" command"); } - plugin->free_exploded_string (plugin, argv); + + if (argv) + plugin->free_exploded_string (plugin, argv); + return 1; } diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 9a4f54d63..a2e7f7567 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -670,7 +670,13 @@ weechat_python_cmd (t_weechat_plugin *plugin, (void) handler_args; (void) handler_pointer; - argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + if (arguments) + argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + else + { + argv = NULL; + argc = 0; + } switch (argc) { @@ -783,7 +789,10 @@ weechat_python_cmd (t_weechat_plugin *plugin, plugin->printf_server (plugin, "Python error: wrong argument count for \"python\" command"); } - plugin->free_exploded_string (plugin, argv); + + if (argv) + plugin->free_exploded_string (plugin, argv); + return 1; } diff --git a/weechat/src/plugins/scripts/perl/weechat-perl.c b/weechat/src/plugins/scripts/perl/weechat-perl.c index 504a0a596..543c39ba5 100644 --- a/weechat/src/plugins/scripts/perl/weechat-perl.c +++ b/weechat/src/plugins/scripts/perl/weechat-perl.c @@ -531,7 +531,13 @@ weechat_perl_cmd (t_weechat_plugin *plugin, (void) handler_args; (void) handler_pointer; - argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + if (arguments) + argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + else + { + argv = NULL; + argc = 0; + } switch (argc) { @@ -639,7 +645,10 @@ weechat_perl_cmd (t_weechat_plugin *plugin, plugin->printf_server (plugin, "Perl error: wrong argument count for \"perl\" command"); } - plugin->free_exploded_string (plugin, argv); + + if (argv) + plugin->free_exploded_string (plugin, argv); + return 1; } diff --git a/weechat/src/plugins/scripts/python/weechat-python.c b/weechat/src/plugins/scripts/python/weechat-python.c index 9a4f54d63..a2e7f7567 100644 --- a/weechat/src/plugins/scripts/python/weechat-python.c +++ b/weechat/src/plugins/scripts/python/weechat-python.c @@ -670,7 +670,13 @@ weechat_python_cmd (t_weechat_plugin *plugin, (void) handler_args; (void) handler_pointer; - argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + if (arguments) + argv = plugin->explode_string (plugin, arguments, " ", 0, &argc); + else + { + argv = NULL; + argc = 0; + } switch (argc) { @@ -783,7 +789,10 @@ weechat_python_cmd (t_weechat_plugin *plugin, plugin->printf_server (plugin, "Python error: wrong argument count for \"python\" command"); } - plugin->free_exploded_string (plugin, argv); + + if (argv) + plugin->free_exploded_string (plugin, argv); + return 1; }