aboutsummaryrefslogtreecommitdiff
path: root/src/Tabs.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-10-13 04:21:23 +0200
committerdec05eba <dec05eba@protonmail.com>2021-10-13 04:21:23 +0200
commit522285b55556b954c786d254388c4b0e45f05a14 (patch)
treeb1f8038e2d7c930ed5541b3f76cd319c3946e824 /src/Tabs.cpp
parent7d4825e3c466ec90ea3e6508545636ead96ec164 (diff)
Fix lbry launch icon not loading, incorrect tabs body items cleared on tab switch
Diffstat (limited to 'src/Tabs.cpp')
-rw-r--r--src/Tabs.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Tabs.cpp b/src/Tabs.cpp
index 866589b..059a8d8 100644
--- a/src/Tabs.cpp
+++ b/src/Tabs.cpp
@@ -37,7 +37,8 @@ namespace QuickMedia {
}
void Tabs::move_selected_tab(int new_tab) {
- const int tab_diff = new_tab - selected_tab;
+ const int prev_tab = selected_tab;
+ const int tab_diff = new_tab - prev_tab;
if(tab_diff > 0) {
while(selected_tab < new_tab) {
@@ -58,7 +59,7 @@ namespace QuickMedia {
}
if(on_change_tab)
- on_change_tab(selected_tab);
+ on_change_tab(prev_tab, selected_tab);
}
void Tabs::on_event(sf::Event &event) {
@@ -221,7 +222,8 @@ namespace QuickMedia {
}
void Tabs::set_selected(int index) {
- move_selected_tab(index);
+ if(index >= 0 && index < (int)tabs.size())
+ move_selected_tab(index);
}
int Tabs::get_selected() const {