diff options
author | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-04-04 18:58:13 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@stuvel.eu> | 2019-04-04 18:59:46 +0300 |
commit | 3b2ea265547c4bff69b37268e50463c7f020b30d (patch) | |
tree | 9547f2ff2d18ceb04b86f3b76eb95fcf4a7bbe1c /intern/audaspace | |
parent | ceded86de32db576b4d31ae6b86ad155f67b77bc (diff) |
Fix segfault when audio system cannot be initialised
`PyInit_aud()` can return `NULL` for variour reasons. When that happens,
we shouldn't continue.
Diffstat (limited to 'intern/audaspace')
-rw-r--r-- | intern/audaspace/intern/AUD_PyInit.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
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); |