mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
recover from corrupt chat player index
This should never happen, but it did and I want to stop local crashes to investigate.
This commit is contained in:
parent
d90314b153
commit
1f5ff11a9a
2 changed files with 5 additions and 2 deletions
|
@ -162,8 +162,9 @@ public class ChatDelegate extends DelegateBase {
|
|||
TextView view = (TextView)row.findViewById( R.id.chat_row_text );
|
||||
view.setText( msg );
|
||||
view = (TextView)row.findViewById( R.id.chat_row_name );
|
||||
view.setText( getString( R.string.chat_sender_fmt,
|
||||
m_names[playerIndx] ) );
|
||||
|
||||
String name = playerIndx < m_names.length ? m_names[playerIndx] : "<???>";
|
||||
view.setText( getString( R.string.chat_sender_fmt, name ) );
|
||||
|
||||
if ( tsSeconds > 0 ) {
|
||||
long now = 1000L * Utils.getCurSeconds();
|
||||
|
|
|
@ -722,6 +722,7 @@ sendChatTo( ServerCtxt* server, XP_U16 devIndex, const XP_UCHAR* msg,
|
|||
XWStreamCtxt* stream = messageStreamWithHeader( server, devIndex,
|
||||
XWPROTO_CHAT );
|
||||
stringToStream( stream, msg );
|
||||
XP_ASSERT( from < server->vol.gi->nPlayers );
|
||||
stream_putU8( stream, from );
|
||||
stream_putU32( stream, timestamp );
|
||||
stream_destroy( stream );
|
||||
|
@ -765,6 +766,7 @@ receiveChat( ServerCtxt* server, XWStreamCtxt* incoming )
|
|||
sendChatToClientsExcept( server, sourceClientIndex, msg, from,
|
||||
timestamp );
|
||||
}
|
||||
XP_ASSERT( from < server->vol.gi->nPlayers );
|
||||
util_showChat( server->vol.util, msg, from, timestamp );
|
||||
XP_FREE( server->mpool, msg );
|
||||
return XP_TRUE;
|
||||
|
|
Loading…
Add table
Reference in a new issue