aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
authorTom Schwindl <schwindl@posteo.de>2022-07-24 10:38:01 +0000
committerFelix Van der Jeugt <felix.vanderjeugt@posteo.net>2022-07-27 08:19:53 +0200
commitc9c01dc5b0586421569b7e3e24249020378b341c (patch)
treee86619308484eb3ae238984a962fbb3d1d52560d /vis.c
parent7c22e881df5a4270ee0f1c112bda43e056949d88 (diff)
downloadvis-c9c01dc5b0586421569b7e3e24249020378b341c.tar.gz
vis-c9c01dc5b0586421569b7e3e24249020378b341c.tar.xz
vis: Some duplicate files were overlooked due to a condition in the wrong place
Diffstat (limited to 'vis.c')
-rw-r--r--vis.c12
1 files changed, 7 insertions, 5 deletions
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) {