Fixed a null exception if the server log UI hasn't been opened and the max number of lines is reached
This commit is contained in:
@@ -30,7 +30,7 @@ namespace Barotrauma.Networking
|
|||||||
Error
|
Error
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color[] messageColor = new Color[]
|
private readonly Color[] messageColor =
|
||||||
{
|
{
|
||||||
Color.LightBlue,
|
Color.LightBlue,
|
||||||
new Color(255, 142, 0),
|
new Color(255, 142, 0),
|
||||||
@@ -40,7 +40,7 @@ namespace Barotrauma.Networking
|
|||||||
Color.Red
|
Color.Red
|
||||||
};
|
};
|
||||||
|
|
||||||
private string[] messageTypeName = new string[]
|
private readonly string[] messageTypeName =
|
||||||
{
|
{
|
||||||
"Chat message",
|
"Chat message",
|
||||||
"Item interaction",
|
"Item interaction",
|
||||||
@@ -105,9 +105,13 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
while (lines.Count > LinesPerFile)
|
while (lines.Count > LinesPerFile)
|
||||||
{
|
{
|
||||||
listBox.RemoveChild(listBox.children[0]);
|
|
||||||
lines.Dequeue();
|
lines.Dequeue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (listBox != null && listBox.children.Count > LinesPerFile)
|
||||||
|
{
|
||||||
|
listBox.RemoveChild(listBox.children[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateLogFrame()
|
public void CreateLogFrame()
|
||||||
@@ -164,7 +168,7 @@ namespace Barotrauma.Networking
|
|||||||
if (listBox.BarScroll == 0.0f || listBox.BarScroll == 1.0f) listBox.BarScroll = 1.0f;
|
if (listBox.BarScroll == 0.0f || listBox.BarScroll == 1.0f) listBox.BarScroll = 1.0f;
|
||||||
|
|
||||||
GUIButton closeButton = new GUIButton(new Rectangle(-100, 10, 100, 15), "Close", Alignment.BottomRight, "", innerFrame);
|
GUIButton closeButton = new GUIButton(new Rectangle(-100, 10, 100, 15), "Close", Alignment.BottomRight, "", innerFrame);
|
||||||
closeButton.OnClicked = (GUIButton button, object userData) =>
|
closeButton.OnClicked = (button, userData) =>
|
||||||
{
|
{
|
||||||
LogFrame = null;
|
LogFrame = null;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user