@@ -1649,7 +1649,10 @@ bool CServerBrowser::ConnectToSelectedServer()
16491649
16501650 if (strPassword.empty ()) // No password could be found, popup password entry.
16511651 {
1652- CServerInfo::GetSingletonPtr ()->Show (eWindowTypes::SERVER_INFO_PASSWORD, pServer->strHost .c_str (), pServer->usGamePort , " " , pServer);
1652+ if (CServerInfo* pServerInfo = CServerInfo::GetSingletonPtr ())
1653+ {
1654+ pServerInfo->Show (eWindowTypes::SERVER_INFO_PASSWORD, pServer->strHost .c_str (), pServer->usGamePort , " " , pServer);
1655+ }
16531656 return true ;
16541657 }
16551658 }
@@ -1679,9 +1682,29 @@ bool CServerBrowser::OnRefreshClick(CGUIElement* pElement)
16791682
16801683bool CServerBrowser::OnInfoClick (CGUIElement* pElement)
16811684{
1685+ ServerBrowserType Type = GetCurrentServerBrowserType ();
1686+
1687+ // First try to get the selected server from the list
1688+ CServerListItem* pServer = FindSelectedServer (Type);
1689+ if (pServer && CServerListItem::StaticIsValid (pServer) &&
1690+ pServer->Address .s_addr != 0 && pServer->usGamePort != 0 &&
1691+ !pServer->strHost .empty ())
1692+ {
1693+ // Use the selected server's information directly
1694+ const SString& strHost = pServer->strHost ;
1695+ unsigned short usPort = pServer->usGamePort ;
1696+
1697+ if (CServerInfo* pServerInfo = CServerInfo::GetSingletonPtr ())
1698+ {
1699+ pServerInfo->Show (eWindowTypes::SERVER_INFO_RAW, strHost.c_str (), usPort, " " , pServer);
1700+ return true ;
1701+ }
1702+ }
1703+
1704+ // Fallback to using the address bar if no server is selected
16821705 unsigned short usPort;
16831706 std::string strHost, strNick, strPassword;
1684- SString strURI = m_pEditAddress[GetCurrentServerBrowserType () ]->GetText ();
1707+ SString strURI = m_pEditAddress[Type ]->GetText ();
16851708
16861709 // Trim leading spaces from the URI
16871710 strURI = strURI.TrimStart (" " );
@@ -1695,7 +1718,10 @@ bool CServerBrowser::OnInfoClick(CGUIElement* pElement)
16951718
16961719 g_pCore->GetConnectParametersFromURI (strURI.c_str (), strHost, usPort, strNick, strPassword);
16971720
1698- CServerInfo::GetSingletonPtr ()->Show (eWindowTypes::SERVER_INFO_RAW, strHost.c_str (), usPort, strPassword.c_str ());
1721+ if (CServerInfo* pServerInfo = CServerInfo::GetSingletonPtr ())
1722+ {
1723+ pServerInfo->Show (eWindowTypes::SERVER_INFO_RAW, strHost.c_str (), usPort, strPassword.c_str ());
1724+ }
16991725 return true ;
17001726}
17011727
0 commit comments