From 4980430b52aa4319cd39f22d9dbf7c27298f69e1 Mon Sep 17 00:00:00 2001 From: Josh Allen Date: Sun, 15 Aug 2004 02:57:13 +0000 Subject: [PATCH] Fixed an intermittent bug when gathering profile names (Player Names) for use in the Hello Packet destine for the server. --- stepmania/src/NetworkSyncManager.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/stepmania/src/NetworkSyncManager.cpp b/stepmania/src/NetworkSyncManager.cpp index 8f3095a748..922c19d74f 100644 --- a/stepmania/src/NetworkSyncManager.cpp +++ b/stepmania/src/NetworkSyncManager.cpp @@ -96,15 +96,18 @@ void NetworkSyncManager::PostStartUp(CString ServerIP) Write1(m_packet, (uint8_t) ctr); vector profileNames; + profileNames.push_back("[No Prof]"); //Make a no profile option PROFILEMAN->GetLocalProfileNames(profileNames); FOREACH_PlayerNumber(pn) { - int localID = atoi(PREFSMAN->m_sDefaultLocalProfileID[pn])-1; - if (localID >= 0 && localID < int(profileNames.size())) - WriteNT(m_packet, profileNames[localID]); - else - WriteNT(m_packet, "[No Prof]"); + int localID = atoi(PREFSMAN->m_sDefaultLocalProfileID[pn]); + /* If the length of the m_sDefaultLocalProfileID[pn] is greater than 0 + there must be a profile there. */ + if (PREFSMAN->m_sDefaultLocalProfileID[pn].length() > 0) + WriteNT(m_packet, profileNames[localID+1]); + else + WriteNT(m_packet, profileNames[localID]); } NetPlayerClient->SendPack((char*)m_packet.Data,m_packet.Position);