vim-patch:8.0.1512: warning for possibly using NULL pointer

Problem:    Warning for possibly using NULL pointer. (Coverity)
Solution:   Skip using the pointer if it's NULL.
e4db7aedab
This commit is contained in:
Jan Edmund Lazo
2018-07-23 00:23:18 -04:00
parent 9fbbec76aa
commit 84b8612987
7 changed files with 45 additions and 32 deletions

View File

@@ -4977,7 +4977,8 @@ void fix_help_buffer(void)
while (*p != NUL) {
copy_option_part(&p, NameBuff, MAXPATHL, ",");
rt = (char_u *)vim_getenv("VIMRUNTIME");
if (path_full_compare(rt, NameBuff, FALSE) != kEqualFiles) {
if (rt != NULL
&& path_full_compare(rt, NameBuff, false) != kEqualFiles) {
int fcount;
char_u **fnames;
FILE *fd;
@@ -5197,8 +5198,9 @@ static void helptags_one(char_u *dir, char_u *ext, char_u *tagfname,
* add the "help-tags" tag.
*/
ga_init(&ga, (int)sizeof(char_u *), 100);
if (add_help_tags || path_full_compare((char_u *)"$VIMRUNTIME/doc",
dir, FALSE) == kEqualFiles) {
if (add_help_tags
|| path_full_compare((char_u *)"$VIMRUNTIME/doc",
dir, false) == kEqualFiles) {
s = xmalloc(18 + STRLEN(tagfname));
sprintf((char *)s, "help-tags\t%s\t1\n", tagfname);
GA_APPEND(char_u *, &ga, s);