aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/vim.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-06-07 10:56:44 +0200
committerGitHub <noreply@github.com>2018-06-07 10:56:44 +0200
commit3abf17ae88e3048c20b1645b9d78b69566e89872 (patch)
treefebd1791bc04f577fd84563bb0eae7512a1b8957 /src/nvim/api/vim.c
parent5a82afa17aa7dec33af2f9c67e7786e7b5e9e8bb (diff)
downloadrneovim-3abf17ae88e3048c20b1645b9d78b69566e89872.tar.gz
rneovim-3abf17ae88e3048c20b1645b9d78b69566e89872.tar.bz2
rneovim-3abf17ae88e3048c20b1645b9d78b69566e89872.zip
API: validation: mention invalid method name (#8489)
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r--src/nvim/api/vim.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index b73ecc2d03..b3ae52602b 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -16,6 +16,7 @@
#include "nvim/api/private/dispatch.h"
#include "nvim/api/buffer.h"
#include "nvim/msgpack_rpc/channel.h"
+#include "nvim/msgpack_rpc/helpers.h"
#include "nvim/lua/executor.h"
#include "nvim/vim.h"
#include "nvim/buffer.h"
@@ -1163,6 +1164,11 @@ Array nvim_call_atomic(uint64_t channel_id, Array calls, Error *err)
MsgpackRpcRequestHandler handler = msgpack_rpc_get_handler_for(name.data,
name.size);
+ if (handler.fn == msgpack_rpc_handle_missing_method) {
+ api_set_error(&nested_error, kErrorTypeException, "Invalid method: %s",
+ name.size > 0 ? name.data : "<empty>");
+ break;
+ }
Object result = handler.fn(channel_id, args, &nested_error);
if (ERROR_SET(&nested_error)) {
// error handled after loop