From 40aecd688e905a9e6ce47d84173dbd8940fe21da Mon Sep 17 00:00:00 2001 From: fredb Date: Tue, 16 Jan 2007 21:34:18 +0000 Subject: [PATCH] Don't segfault when dir is empty --- simgear/misc/sg_path.cxx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 4cfc3576..ce466142 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -195,6 +195,8 @@ bool SGPath::exists() const { void SGPath::create_dir( mode_t mode ) { string_list dirlist = sgPathSplit(dir()); + if ( dirlist.empty() ) + return; string path = dirlist[0]; string_list path_elements = sgPathBranchSplit(path); bool absolute = !path.empty() && path[0] == sgDirPathSep; -- 2.39.5