From 53e884dd223dbe9b47cf26833977d8e43cbae9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20G=2E=20Aragoneses?= Date: Sat, 2 Nov 2013 21:53:20 +0100 Subject: [PATCH] gtk: fix Application to be more robust when embedding mono When embedding mono, Environment.GetCommandLineArgs() would not return an array with any element. Reported in the mailing list, by Vardar Sahin. --- gtk/Application.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk/Application.cs b/gtk/Application.cs index a37139cd9..1aaebb7ce 100755 --- a/gtk/Application.cs +++ b/gtk/Application.cs @@ -64,7 +64,9 @@ namespace Gtk { static void SetPrgname () { - GLib.Global.ProgramName = System.IO.Path.GetFileNameWithoutExtension (Environment.GetCommandLineArgs () [0]); + var args = Environment.GetCommandLineArgs (); + if (args != null && args.Length > 0) + GLib.Global.ProgramName = System.IO.Path.GetFileNameWithoutExtension (args [0]); } public static void Init ()