Recoil Posted June 30, 2015 Share Posted June 30, 2015 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 More sharing options...
jcsnider Posted June 30, 2015 Share Posted June 30, 2015 Can you highlight/tell me which line is erroring & copy/paste the call stack when the error occurs? Link to comment Share on other sites More sharing options...
Recoil Posted June 30, 2015 Author Share Posted June 30, 2015 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 More sharing options...
jcsnider Posted July 1, 2015 Share Posted July 1, 2015 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: Link to comment Share on other sites More sharing options...
Recoil Posted July 1, 2015 Author Share Posted July 1, 2015 Sorry, it is being called from AddText() Link to comment Share on other sites More sharing options...
jcsnider Posted July 1, 2015 Share Posted July 1, 2015 Perfect. Remove that call to UpdateUI. It should update in the following server loop which is on the correct thread. Let me know how that fairs. Link to comment Share on other sites More sharing options...
Recoil Posted July 1, 2015 Author Share Posted July 1, 2015 When I remove the call from AddText it will not display anything on the server window. Link to comment Share on other sites More sharing options...
jcsnider Posted July 1, 2015 Share Posted July 1, 2015 Okay, put that back but make it look like this: If not ServerOnline Then UpdateUI Link to comment Share on other sites More sharing options...
Recoil Posted July 1, 2015 Author Share Posted July 1, 2015 That worked Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now