aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/autocmd.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/nvim/api/autocmd.c b/src/nvim/api/autocmd.c
index ad0e78cb50..0ad7b320d0 100644
--- a/src/nvim/api/autocmd.c
+++ b/src/nvim/api/autocmd.c
@@ -1,3 +1,6 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
#include <stdbool.h>
#include <stdio.h>
@@ -128,10 +131,8 @@ Array nvim_get_autocmds(Dict(get_autocmds) *opts, Error *err)
continue;
}
- for (AutoPat *ap = au_get_autopat_for_event(event);
- ap != NULL;
- ap = ap->next) {
- if (ap == NULL || ap->cmds == NULL) {
+ for (AutoPat *ap = au_get_autopat_for_event(event); ap != NULL; ap = ap->next) {
+ if (ap->cmds == NULL) {
continue;
}
@@ -423,13 +424,6 @@ Integer nvim_create_autocmd(uint64_t channel_id, Object event, Dict(create_autoc
ADD(patterns, STRING_OBJ(cstr_to_string((char *)pattern_buflocal)));
}
- if (aucmd.type == CALLABLE_NONE) {
- api_set_error(err,
- kErrorTypeValidation,
- "'command' or 'callback' is required");
- goto cleanup;
- }
-
if (opts->desc.type != kObjectTypeNil) {
if (opts->desc.type == kObjectTypeString) {
desc = opts->desc.data.string.data;