ao_audiotrack: fix broken exception checks

The exception always has to be checked and cleared even if we
can already see that no valid value was returned.
This commit is contained in:
sfan5 2023-08-06 15:57:32 +02:00
parent efebd50a6c
commit a949e58362
1 changed files with 3 additions and 3 deletions

View File

@ -332,7 +332,7 @@ static int AudioTrack_New(struct ao *ao)
p->cfg_session_id
);
}
if (!audiotrack || MP_JNI_EXCEPTION_LOG(ao) < 0) {
if (MP_JNI_EXCEPTION_LOG(ao) < 0 || !audiotrack) {
MP_FATAL(ao, "AudioTrack Init failed\n");
return -1;
}
@ -709,7 +709,7 @@ static int init(struct ao *ao)
p->channel_config,
p->format
);
if (buffer_size <= 0 || MP_JNI_EXCEPTION_LOG(ao) < 0) {
if (MP_JNI_EXCEPTION_LOG(ao) < 0 || buffer_size <= 0) {
MP_FATAL(ao, "AudioTrack.getMinBufferSize returned an invalid size: %d", buffer_size);
return -1;
}
@ -724,7 +724,7 @@ static int init(struct ao *ao)
p->chunk = talloc_size(ao, p->size);
jobject timestamp = MP_JNI_NEW(AudioTimestamp.clazz, AudioTimestamp.ctor);
if (!timestamp || MP_JNI_EXCEPTION_LOG(ao) < 0) {
if (MP_JNI_EXCEPTION_LOG(ao) < 0 || !timestamp) {
MP_FATAL(ao, "AudioTimestamp could not be created\n");
return -1;
}