From cc5c25f8bbdae23dda07fdfdb8864db5686cf05d Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianasulu@gmail.com>
Date: Tue, 12 Oct 2021 13:55:32 +0300
Subject: [PATCH 2/3] Better fix for mwindow not available

---
 cinelerra-5.1/cinelerra/mwindow.C | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C
index b3a12239..eef24258 100644
--- a/cinelerra-5.1/cinelerra/mwindow.C
+++ b/cinelerra-5.1/cinelerra/mwindow.C
@@ -700,7 +700,7 @@ int MWindow::init_plugins(MWindow *mwindow, Preferences *preferences)
 	// index_id is 2nd line of the index file, normally full plugin path,
 	// but fixed value if AppImage because the path changes on each run.
 	// And if the second line does not match on the next run the index is rebuilt.
-	if( mwindow->is_appimage() && getenv("CINGG_BUILD")) strcpy(index_id, getenv("CINGG_BUILD"));
+	if( mwindow && mwindow->is_appimage() && getenv("CINGG_BUILD")) strcpy(index_id, getenv("CINGG_BUILD"));
 	else strcpy(index_id, plugin_path);
 	FILE *fp = fopen(index_path,"a+");
 	if( !fp ) {
-- 
2.33.0

