UI: Fix crash on macOS if no python path is set in configuration
Obvious fix guarding against calling the std::string constructor with a NULL pointer.
This commit is contained in:
parent
5ea10fec82
commit
1766f01b7a
@ -653,8 +653,10 @@ extern "C" void InitScripts()
|
|||||||
config_get_string(config, "Python", "Path" ARCH_NAME);
|
config_get_string(config, "Python", "Path" ARCH_NAME);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
if (python_path && *python_path) {
|
||||||
std::string _python_path(python_path);
|
std::string _python_path(python_path);
|
||||||
std::size_t pos = _python_path.find("/Python.framework/Versions");
|
std::size_t pos =
|
||||||
|
_python_path.find("/Python.framework/Versions");
|
||||||
|
|
||||||
if (pos != std::string::npos) {
|
if (pos != std::string::npos) {
|
||||||
std::string _temp = _python_path.substr(0, pos);
|
std::string _temp = _python_path.substr(0, pos);
|
||||||
@ -663,6 +665,7 @@ extern "C" void InitScripts()
|
|||||||
config_save(config);
|
config_save(config);
|
||||||
python_path = _temp.c_str();
|
python_path = _temp.c_str();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!obs_scripting_python_loaded() && python_path && *python_path)
|
if (!obs_scripting_python_loaded() && python_path && *python_path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user