Jump to content

UpdateUI logout error


Recoil

Recommended Posts

This was happening periodically before the update changes.  Now it happens all the time.  I can bypass the exception, but there has to be a way to keep it from happening.  I have no idea what to do though.

A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll

Additional information: InvalidArgument=Value of '0' is not valid for 'index'.

Sub UpdateUI()
        If ConsoleText <> frmServer.txtText.Text Then
            frmServer.txtText.Text = ConsoleText
            frmServer.txtText.SelectionStart = frmServer.txtText.TextLength
            frmServer.txtText.ScrollToCaret()
        End If
        If NeedToUpDatePlayerList = True Then
            UpdateCaption()
            For i = 1 To MaxPlayers
                If Not Clients(i) Is Nothing Then
                    If Not Clients(i).Socket Is Nothing Then
                        If Clients(i).Socket.Connected Then
                            frmServer.lstView.Items(i - 1).SubItems(1).Text = Clients(i).IP
                            If Player(i).Login <> "" Then
                                frmServer.lstView.Items(i - 1).SubItems(2).Text = Player(i).Login
                                If Player(i).Name <> "" Then
                                    frmServer.lstView.Items(i - 1).SubItems(3).Text = Player(i).Name
                                Else
                                    frmServer.lstView.Items(i - 1).SubItems(3).Text = ""
                                End If
                            Else
                                frmServer.lstView.Items(i - 1).SubItems(2).Text = ""
                                frmServer.lstView.Items(i - 1).SubItems(3).Text = ""
                            End If
                        Else
                            frmServer.lstView.Items(i - 1).SubItems(1).Text = ""
                            frmServer.lstView.Items(i - 1).SubItems(2).Text = ""
                            frmServer.lstView.Items(i - 1).SubItems(3).Text = ""
                        End If
                    Else
                        frmServer.lstView.Items(i - 1).SubItems(1).Text = "" ' <-HERE
                        frmServer.lstView.Items(i - 1).SubItems(2).Text = ""
                        frmServer.lstView.Items(i - 1).SubItems(3).Text = ""
                    End If
                Else
                    frmServer.lstView.Items(i - 1).SubItems(1).Text = ""
                    frmServer.lstView.Items(i - 1).SubItems(2).Text = ""
                    frmServer.lstView.Items(i - 1).SubItems(3).Text = ""
                End If
            Next
            NeedToUpDatePlayerList = False
        End If
    End Sub

Link to comment
Share on other sites

I guess I didn't indicate that it is marked <-HERE on line 13 from the bottom.  Is this what you need from the callstack?

> Orion Revamped Server.exe!OrionRevampedServer.modGameLogic.UpdateUI() Line 175 Basic

Link to comment
Share on other sites

I want to know where UpdateUI() is called from. If it is a sub on a different thread this might make sense.

When the error occurs click Debug > Windows > Call Stack and upload a photo of your callstack like mine below:

772969189005.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...