Skip to content

Commit 63d0b1b

Browse files
committed
Functions retrieving sound assets should check for null
1 parent ad444d7 commit 63d0b1b

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

scripts/functions/Function_Sound.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,8 +1509,9 @@ function audio_sound_get_gain(_index)
15091509
else {
15101510
const asset = Audio_GetSound(_index);
15111511

1512-
if (asset !== undefined)
1512+
if (asset !== null) {
15131513
return asset.gain.get();
1514+
}
15141515
}
15151516

15161517
return 0;
@@ -1643,8 +1644,7 @@ function audio_sound_get_track_position(_soundid)
16431644
{
16441645
const sound_asset = Audio_GetSound(_soundid);
16451646

1646-
if (sound_asset != undefined)
1647-
{
1647+
if (sound_asset !== null) {
16481648
return sound_asset.trackPos;
16491649
}
16501650
}
@@ -1678,8 +1678,7 @@ function audio_sound_set_track_position(_soundid, _time)
16781678
{
16791679
const sampleData = Audio_GetSound(_soundid);
16801680

1681-
if (sampleData != undefined)
1682-
{
1681+
if (sampleData !== null) {
16831682
sampleData.trackPos = _time;
16841683
}
16851684
}

0 commit comments

Comments
 (0)