File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -157,14 +157,12 @@ void ServerList::onContentAvailable() {
157157
158158void ServerList::willAppear (bool resetState) {
159159 auto list = AppConfig::instance ().getServers ();
160- if (list.empty ()) {
161- this ->tabFrame ->setTabAttachedView (new ServerAdd ());
162- return ;
163- }
160+ ServerCell* item = nullptr ;
161+ std::string url = AppConfig::instance ().getUrl ();
164162 this ->sidebarServers ->clearViews ();
165163
166164 for (auto & s : list) {
167- ServerCell* item = new ServerCell (s);
165+ item = new ServerCell (s);
168166 item->getFocusEvent ()->subscribe ([this , s](brls::View* view) {
169167 this ->setActive (view);
170168 this ->onServer (s);
@@ -183,13 +181,20 @@ void ServerList::willAppear(bool resetState) {
183181 return true ;
184182 });
185183
186- if (s.urls .front () == AppConfig::instance ().getUrl ()) {
187- item->setActive (true );
188- this ->onServer (s);
184+ if (s.urls .size () > 0 ) {
185+ if (url.empty ()) {
186+ url = s.urls .front ();
187+ }
188+ if (s.urls .front () == url) {
189+ item->setActive (true );
190+ this ->onServer (s);
191+ }
189192 }
190193
191194 this ->sidebarServers ->addView (item);
192195 }
196+
197+ if (!item) this ->tabFrame ->setTabAttachedView (new ServerAdd ());
193198}
194199
195200void ServerList::onServer (const AppServer& s) {
You can’t perform that action at this time.
0 commit comments