From 9e6ad3dffc867be36f758f593c2db78cef3d0250 Mon Sep 17 00:00:00 2001 From: Stephen Swaney Date: Sat, 13 Aug 2005 17:20:46 +0000 Subject: [PATCH] bugfix #2931 crash if $HOME not set unchecked pointer returned from BLI_gethome(). --- source/blender/python/api2_2x/EXPP_interface.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/python/api2_2x/EXPP_interface.c b/source/blender/python/api2_2x/EXPP_interface.c index f6ad76b0515..48448347559 100644 --- a/source/blender/python/api2_2x/EXPP_interface.c +++ b/source/blender/python/api2_2x/EXPP_interface.c @@ -69,8 +69,15 @@ char *bpy_gethome(int append_scriptsdir) else if (homedir[0] != '\0') return homedir; + /* BLI_gethome() can return NULL if env vars are not set */ s = BLI_gethome(); + if( !s ) /* bail if no $HOME */ + { + printf("$HOME is NOT set\n"); + return NULL; + } + if( strstr( s, ".blender" ) ) PyOS_snprintf( homedir, FILE_MAXDIR, s ); else