From c26863cc1e4ed5b394b20366187bf137c8d7de52 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Tue, 18 Jul 2023 21:02:11 +0100 Subject: [PATCH] Don't try to enable sequential mode on non-existant files on GTK Fixes https://gitlab.com/kicad/code/kicad/-/issues/15222 --- libs/kiplatform/gtk/io.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/kiplatform/gtk/io.cpp b/libs/kiplatform/gtk/io.cpp index 47cc4a5ab0..51443c67d6 100644 --- a/libs/kiplatform/gtk/io.cpp +++ b/libs/kiplatform/gtk/io.cpp @@ -30,7 +30,8 @@ FILE* KIPLATFORM::IO::SeqFOpen( const wxString& aPath, const wxString& aMode ) { FILE* fp = wxFopen( aPath, aMode ); - posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL ); + if( fp ) + posix_fadvise( fileno( fp ), 0, 0, POSIX_FADV_SEQUENTIAL ); return fp; }