Fixed GetUser not locating users by ID and hence GetUserById not working either, fixes #395
This commit is contained in:
parent
a3e838c1ce
commit
84789ff4d5
1 changed files with 6 additions and 6 deletions
|
|
@ -257,14 +257,12 @@ namespace TShockAPI.DB
|
|||
try
|
||||
{
|
||||
QueryResult result;
|
||||
if (string.IsNullOrEmpty(user.Address))
|
||||
{
|
||||
if (0 != user.ID)
|
||||
result = database.QueryReader("SELECT * FROM Users WHERE ID=@0", user.ID);
|
||||
else if (string.IsNullOrEmpty(user.Address))
|
||||
result = database.QueryReader("SELECT * FROM Users WHERE Username=@0", user.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = database.QueryReader("SELECT * FROM Users WHERE IP=@0", user.Address);
|
||||
}
|
||||
|
||||
if (result.Read())
|
||||
{
|
||||
|
|
@ -273,7 +271,9 @@ namespace TShockAPI.DB
|
|||
if (!result.Read())
|
||||
return user;
|
||||
|
||||
if (string.IsNullOrEmpty(user.Address))
|
||||
if (0 != user.ID)
|
||||
throw new UserManagerException(String.Format("Multiple users found for id '{0}'", user.ID));
|
||||
else if (string.IsNullOrEmpty(user.Address))
|
||||
throw new UserManagerException(String.Format("Multiple users found for name '{0}'", user.Name));
|
||||
else
|
||||
throw new UserManagerException(String.Format("Multiple users found for ip '{0}'", user.Address));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue