From c9c01dc5b0586421569b7e3e24249020378b341c Mon Sep 17 00:00:00 2001 From: Tom Schwindl Date: Sun, 24 Jul 2022 10:38:01 +0000 Subject: vis: Some duplicate files were overlooked due to a condition in the wrong place --- vis.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 6ee9f22..e6f5d9f 100644 --- a/vis.c +++ b/vis.c @@ -196,11 +196,13 @@ static File *file_new(Vis *vis, const char *name) { File *existing = NULL; /* try to detect whether the same file is already open in another window */ - for (File *file = vis->files; file && file->name; file = file->next) { - if (cmp_names && strcmp(file->name, name_absolute) == 0 || - file->stat.st_dev == new.st_dev && file->stat.st_ino == new.st_ino) { - existing = file; - break; + for (File *file = vis->files; file; file = file->next) { + if (file->name) { + if (cmp_names && strcmp(file->name, name_absolute) == 0 || + file->stat.st_dev == new.st_dev && file->stat.st_ino == new.st_ino) { + existing = file; + break; + } } } if (existing) { -- cgit v1.2.3