Skip to content

Commit

Permalink
add null check to mimic behavior of lwjgl2 (#173)
Browse files Browse the repository at this point in the history
fix error type

Co-authored-by: kstvr32 <kstvr32@gmail.com>
  • Loading branch information
kstvr32 and kstvr32 authored Sep 13, 2024
1 parent bff0296 commit 9c10c03
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/org/lwjglx/openal/AL.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ public static void create() throws LWJGLException {
}

public static void create(String deviceArguments, int contextFrequency, int contextRefresh,
boolean contextSynchronized) {
boolean contextSynchronized) throws LWJGLException {
create(deviceArguments, contextFrequency, contextRefresh, contextSynchronized, true);
}

public static void create(String deviceArguments, int contextFrequency, int contextRefresh,
boolean contextSynchronized, boolean openDevice) {
boolean contextSynchronized, boolean openDevice) throws LWJGLException {
IntBuffer attribs = BufferUtils.createIntBuffer(16);

attribs.put(org.lwjgl.openal.ALC10.ALC_FREQUENCY);
Expand Down Expand Up @@ -64,6 +64,10 @@ public static void create(String deviceArguments, int contextFrequency, int cont

long deviceHandle = org.lwjgl.openal.ALC10.alcOpenDevice(defaultDevice);

if (deviceHandle == 0) {
throw new LWJGLException("Could not open ALC device");
}

alcDevice = new ALCdevice(deviceHandle);
final ALCCapabilities deviceCaps = org.lwjgl.openal.ALC.createCapabilities(deviceHandle);

Expand Down

0 comments on commit 9c10c03

Please sign in to comment.