mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-16 17:45:10 +00:00
GUI: prevent division by zero
This commit is contained in:
parent
dbf4635646
commit
aeea8a4912
1 changed files with 15 additions and 7 deletions
|
@ -66,16 +66,24 @@ void FurnaceGUI::drawNewSong() {
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Cancel")) {
|
if (ImGui::Button("I'm feeling lucky")) {
|
||||||
|
if (sysCategories.size()==0) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
} else {
|
||||||
|
FurnaceGUISysCategory* newSystemCat=&sysCategories[rand()%sysCategories.size()];
|
||||||
|
if (newSystemCat->systems.size()==0) {
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
} else {
|
||||||
|
nextDesc=newSystemCat->systems[rand()%newSystemCat->systems.size()].definition.data();
|
||||||
|
accepted=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
|
||||||
if (ImGui::Button("I'm feeling lucky")) {
|
if (ImGui::Button("Cancel")) {
|
||||||
FurnaceGUISysCategory* newSystemCat=&sysCategories[rand()%sysCategories.size()];
|
ImGui::CloseCurrentPopup();
|
||||||
nextDesc=newSystemCat->systems[rand()%newSystemCat->systems.size()].definition.data();
|
|
||||||
accepted=true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
|
|
Loading…
Reference in a new issue