mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
Fix the sfx selection gui for playsound (#10095)
* fix the index used to get the sfx substring * handle cases where the sxf variable is not a built-in This prevents a crash that happened whenever the sfx variable's name had less than 5 characters (4 before this pr), since the substring method was called regardless of the name's size.
This commit is contained in:
parent
b4a1232407
commit
2ad38fc3b0
1 changed files with 2 additions and 1 deletions
|
|
@ -2149,7 +2149,8 @@ public class LStatements{
|
|||
table.button(b -> {
|
||||
b.image(Icon.pencilSmall);
|
||||
|
||||
b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), id.substring(4), t -> {
|
||||
String soundName = id.startsWith("@sfx-") ? id.substring(5) : id;
|
||||
b.clicked(() -> showSelect(b, GlobalVars.soundNames.toArray(String.class), soundName, t -> {
|
||||
id = "@sfx-" + t;
|
||||
rebuild(table);
|
||||
}, 2, cell -> cell.size(160, 50)));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue