[Bf-blender-cvs] [3b2ea265547] master: Fix segfault when audio system cannot be initialised

Sybren A. Stüvel noreply at git.blender.org
Thu Apr 4 17:59:53 CEST 2019


Commit: 3b2ea265547c4bff69b37268e50463c7f020b30d
Author: Sybren A. Stüvel
Date:   Thu Apr 4 17:58:13 2019 +0200
Branches: master
https://developer.blender.org/rB3b2ea265547c4bff69b37268e50463c7f020b30d

Fix segfault when audio system cannot be initialised

`PyInit_aud()` can return `NULL` for variour reasons. When that happens,
we shouldn't continue.

===================================================================

M	intern/audaspace/intern/AUD_PyInit.cpp

===================================================================

diff --git a/intern/audaspace/intern/AUD_PyInit.cpp b/intern/audaspace/intern/AUD_PyInit.cpp
index df020ed5427..b40cce34dfb 100644
--- a/intern/audaspace/intern/AUD_PyInit.cpp
+++ b/intern/audaspace/intern/AUD_PyInit.cpp
@@ -66,6 +66,11 @@ static PyMethodDef meth_sound_from_pointer[] = {
 PyObject *AUD_initPython(void)
 {
 	PyObject *module = PyInit_aud();
+	if (module == NULL) {
+		printf("Unable to initialise audio\n");
+		return NULL;
+	}
+
 	PyModule_AddObject(module, "_sound_from_pointer", (PyObject *)PyCFunction_New(meth_sound_from_pointer, NULL));
 	PyDict_SetItemString(PyImport_GetModuleDict(), "aud", module);



More information about the Bf-blender-cvs mailing list