diff options
author | James McCoy <jamessan@jamessan.com> | 2017-03-29 21:34:04 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2017-03-29 21:34:04 -0400 |
commit | 1222c82799b9a853c5adaf8761309b616e664c95 (patch) | |
tree | da02275e4a346b11d4a8feed10c9def4ec4ff364 | |
parent | 91dfebf0506c4389af77071323798fdd7360c589 (diff) | |
download | rneovim-1222c82799b9a853c5adaf8761309b616e664c95.tar.gz rneovim-1222c82799b9a853c5adaf8761309b616e664c95.tar.bz2 rneovim-1222c82799b9a853c5adaf8761309b616e664c95.zip |
coverity/16127: Verify lang is non-NULL before calling strlen
-rw-r--r-- | src/nvim/option.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 9b31e14ea7..69c12e2cc7 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -1054,13 +1054,15 @@ void set_init_3(void) */ void set_helplang_default(const char *lang) { - int idx; + if (lang == NULL) { + return; + } const size_t lang_len = strlen(lang); - if (lang == NULL || lang_len < 2) { // safety check + if (lang_len < 2) { // safety check return; } - idx = findoption("hlg"); + int idx = findoption("hlg"); if (idx >= 0 && !(options[idx].flags & P_WAS_SET)) { if (options[idx].flags & P_ALLOCED) free_string_option(p_hlg); |