[Command] Fix #copycharacter command crash (#2446)

This commit is contained in:
Chris Miles 2022-09-25 12:00:25 -05:00 committed by GitHub
parent 1ce272a1c3
commit 78a9de124e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -2199,9 +2199,9 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
* @return * @return
*/ */
bool Database::CopyCharacter( bool Database::CopyCharacter(
std::string source_character_name, const std::string& source_character_name,
std::string destination_character_name, const std::string& destination_character_name,
std::string destination_account_name const std::string& destination_account_name
) )
{ {
auto results = QueryDatabase( auto results = QueryDatabase(
@ -2213,6 +2213,7 @@ bool Database::CopyCharacter(
if (results.RowCount() == 0) { if (results.RowCount() == 0) {
LogError("No character found with name [{}]", source_character_name); LogError("No character found with name [{}]", source_character_name);
return false;
} }
auto row = results.begin(); auto row = results.begin();
@ -2227,6 +2228,7 @@ bool Database::CopyCharacter(
if (results.RowCount() == 0) { if (results.RowCount() == 0) {
LogError("No account found with name [{}]", destination_account_name); LogError("No account found with name [{}]", destination_account_name);
return false;
} }
row = results.begin(); row = results.begin();

View File

@ -113,9 +113,9 @@ public:
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone); bool SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone);
bool UpdateName(const char *oldname, const char *newname); bool UpdateName(const char *oldname, const char *newname);
bool CopyCharacter( bool CopyCharacter(
std::string source_character_name, const std::string& source_character_name,
std::string destination_character_name, const std::string& destination_character_name,
std::string destination_account_name const std::string& destination_account_name
); );
/* General Information Queries */ /* General Information Queries */