Skip to content

Commit

Permalink
add null check to mimic behavior of lwjgl2
Browse files Browse the repository at this point in the history
  • Loading branch information
kstvr32 committed Sep 13, 2024
1 parent 86d9a76 commit ead5107
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/generated/java/org/lwjgl/LWJGLException.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@

public class LWJGLException extends java.lang.Exception {

public LWJGLException() {
super();
}

public LWJGLException(String msg) {
super(msg);
}
}
10 changes: 7 additions & 3 deletions src/main/java/org/lwjglx/openal/AL.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ public class AL {
Sys.initialize(); // init using dummy sys method
}

public static void create() throws LWJGLException {
public static void create() throws LWJGLException, org.lwjgl.LWJGLException {
create(null, 44100, 60, false);
}

public static void create(String deviceArguments, int contextFrequency, int contextRefresh,
boolean contextSynchronized) {
boolean contextSynchronized) throws org.lwjgl.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 org.lwjgl.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 org.lwjgl.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 ead5107

Please sign in to comment.