create_interface() return NULL if interface fails to initialize

This commit is contained in:
onyx-and-iris 2024-07-13 11:43:21 +01:00
parent de70cd39cf
commit 453797b0d9

View File

@ -13,8 +13,6 @@
* https://github.com/onyx-and-iris/vmrcli/blob/main/LICENSE * https://github.com/onyx-and-iris/vmrcli/blob/main/LICENSE
*/ */
#include <stdbool.h>
#include <stdio.h>
#include <windows.h> #include <windows.h>
#include "ivmr.h" #include "ivmr.h"
#include "util.h" #include "util.h"
@ -36,6 +34,7 @@ static bool registry_get_voicemeeter_folder(char *szDir);
* @brief Create an interface object * @brief Create an interface object
* *
* @return PT_VMR Pointer to the iVMR interface * @return PT_VMR Pointer to the iVMR interface
* May return NULL if the interface fails to initialize
*/ */
PT_VMR create_interface() PT_VMR create_interface()
{ {
@ -48,13 +47,12 @@ PT_VMR create_interface()
if (rep == -100) if (rep == -100)
{ {
log_fatal("Voicemeeter is not installed"); log_fatal("Voicemeeter is not installed");
exit(EXIT_FAILURE);
} }
else else
{ {
log_fatal("Error loading Voicemeeter dll with code %d\n", rep); log_fatal("Error loading Voicemeeter dll with code %d", rep);
exit(EXIT_FAILURE);
} }
return NULL;
} }
return vmr; return vmr;