@@ -1647,7 +1647,10 @@ bool CServerBrowser::ConnectToSelectedServer()
16471647
16481648 if (strPassword.empty ()) // No password could be found, popup password entry.
16491649 {
1650- CServerInfo::GetSingletonPtr ()->Show (eWindowTypes::SERVER_INFO_PASSWORD, pServer->strHost .c_str (), pServer->usGamePort , " " , pServer);
1650+ if (CServerInfo* pServerInfo = CServerInfo::GetSingletonPtr ())
1651+ {
1652+ pServerInfo->Show (eWindowTypes::SERVER_INFO_PASSWORD, pServer->strHost .c_str (), pServer->usGamePort , " " , pServer);
1653+ }
16511654 return true ;
16521655 }
16531656 }
@@ -1677,9 +1680,29 @@ bool CServerBrowser::OnRefreshClick(CGUIElement* pElement)
16771680
16781681bool CServerBrowser::OnInfoClick (CGUIElement* pElement)
16791682{
1683+ ServerBrowserType Type = GetCurrentServerBrowserType ();
1684+
1685+ // First try to get the selected server from the list
1686+ CServerListItem* pServer = FindSelectedServer (Type);
1687+ if (pServer && CServerListItem::StaticIsValid (pServer) &&
1688+ pServer->Address .s_addr != 0 && pServer->usGamePort != 0 &&
1689+ !pServer->strHost .empty ())
1690+ {
1691+ // Use the selected server's information directly
1692+ const SString& strHost = pServer->strHost ;
1693+ unsigned short usPort = pServer->usGamePort ;
1694+
1695+ if (CServerInfo* pServerInfo = CServerInfo::GetSingletonPtr ())
1696+ {
1697+ pServerInfo->Show (eWindowTypes::SERVER_INFO_RAW, strHost.c_str (), usPort, " " , pServer);
1698+ return true ;
1699+ }
1700+ }
1701+
1702+ // Fallback to using the address bar if no server is selected
16801703 unsigned short usPort;
16811704 std::string strHost, strNick, strPassword;
1682- SString strURI = m_pEditAddress[GetCurrentServerBrowserType () ]->GetText ();
1705+ SString strURI = m_pEditAddress[Type ]->GetText ();
16831706
16841707 // Trim leading spaces from the URI
16851708 strURI = strURI.TrimStart (" " );
@@ -1693,7 +1716,10 @@ bool CServerBrowser::OnInfoClick(CGUIElement* pElement)
16931716
16941717 g_pCore->GetConnectParametersFromURI (strURI.c_str (), strHost, usPort, strNick, strPassword);
16951718
1696- CServerInfo::GetSingletonPtr ()->Show (eWindowTypes::SERVER_INFO_RAW, strHost.c_str (), usPort, strPassword.c_str ());
1719+ if (CServerInfo* pServerInfo = CServerInfo::GetSingletonPtr ())
1720+ {
1721+ pServerInfo->Show (eWindowTypes::SERVER_INFO_RAW, strHost.c_str (), usPort, strPassword.c_str ());
1722+ }
16971723 return true ;
16981724}
16991725
0 commit comments