aboutsummaryrefslogtreecommitdiff
path: root/vis.c
diff options
context:
space:
mode:
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) {