vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 1773705fb0b43bb0aa455aec321a639b29551fd4 parent 05045f93d748ddfa7838216de32f48ac7fcb36b6 Author: Tom Schwindl <schwindl@posteo.de> Date: Sun, 24 Jul 2022 10:38:01 +0000 vis: Some duplicate files were overlooked due to a condition in the wrong place Diffstat:
| M | vis.c | | | 12 | +++++++----- |
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git 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) {