Fix missing NULL check on macOS when system-python isn't found

Regression from cafd6b519c.

D10494 by @ysano with edits.
This commit is contained in:
2021-02-22 21:20:48 +11:00
parent b4147aeeab
commit 06212759bc

View File

@@ -419,16 +419,19 @@ void BPY_python_start(bContext *C, int argc, const char **argv)
/* Allow to use our own included Python. `py_path_bundle` may be NULL. */ /* Allow to use our own included Python. `py_path_bundle` may be NULL. */
{ {
const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL); const char *py_path_bundle = BKE_appdir_folder_id(BLENDER_SYSTEM_PYTHON, NULL);
if (py_path_bundle != NULL) {
# ifdef __APPLE__ # ifdef __APPLE__
/* OSX allow file/directory names to contain : character (represented as / in the Finder) /* Mac-OS allows file/directory names to contain `:` character
* but current Python lib (release 3.1.1) doesn't handle these correctly */ * (represented as `/` in the Finder) but current Python lib (as of release 3.1.1)
* doesn't handle these correctly. */
if (strchr(py_path_bundle, ':')) { if (strchr(py_path_bundle, ':')) {
fprintf(stderr, fprintf(stderr,
"Warning! Blender application is located in a path containing ':' or '/' chars\n" "Warning! Blender application is located in a path containing ':' or '/' chars\n"
"This may make python import function fail\n"); "This may make python import function fail\n");
} }
# endif # endif /* __APPLE__ */
if (py_path_bundle != NULL) {
status = PyConfig_SetBytesString(&config, &config.home, py_path_bundle); status = PyConfig_SetBytesString(&config, &config.home, py_path_bundle);
pystatus_exit_on_error(status); pystatus_exit_on_error(status);
} }