Skip to content

Commit

Permalink
Merge pull request #31 from winglessraven/dev
Browse files Browse the repository at this point in the history
Fix error when clicking whitespace in the player list
  • Loading branch information
winglessraven authored Mar 29, 2021
2 parents c70972b + 01bde81 commit 65296ea
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 33 deletions.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2680,19 +2680,21 @@ private void serverPlayers_SelectedIndexChanged(object sender, EventArgs e)
zPosition.Text = "";
inventoryData.Text = "";

PlayerSteamInfo selectedPlayer = (PlayerSteamInfo)serverPlayers.SelectedItem;
if (selectedPlayer.CharacterIDs.Length > 0)
if(serverPlayers.SelectedItem != null)
{
string tmp = selectedPlayer.CharacterIDs;
PlayerSteamInfo selectedPlayer = (PlayerSteamInfo)serverPlayers.SelectedItem;
if (selectedPlayer.CharacterIDs.Length > 0)
{
string tmp = selectedPlayer.CharacterIDs;

string connectionString = @"Data Source=" + serverFolderPath.Text + "\\" + @"deadmatter\Saved\Database\" + currentDBfile + ";Version=3;Read Only=true";
string connectionString = @"Data Source=" + serverFolderPath.Text + "\\" + @"deadmatter\Saved\Database\" + currentDBfile + ";Version=3;Read Only=true";

SQLiteConnection connection = new SQLiteConnection(connectionString);
try
{
connection.Open();

SQLiteConnection connection = new SQLiteConnection(connectionString);
try
{
connection.Open();


string queryTxt = "SELECT FirstName || ' ' || LastName as Name, ID FROM Characters WHERE PlayerID = '" + tmp + "'";
SQLiteCommand command = new SQLiteCommand(queryTxt, connection);
SQLiteDataReader reader = command.ExecuteReader();
Expand All @@ -2706,13 +2708,15 @@ private void serverPlayers_SelectedIndexChanged(object sender, EventArgs e)
character.Name = reader[0].ToString();
playerCharacters.Items.Add(character);
}

}
catch (Exception exception)
{
//error connecting to db - do something

}
catch (Exception exception)
{
//error connecting to db - do something
}
}
}

}

/// <summary>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 65296ea

Please sign in to comment.