mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-01 08:27:46 +00:00
Char creation will no longer crash lobby/api
This commit is contained in:
parent
6d2c012cf2
commit
6aa7102b4e
3 changed files with 11 additions and 10 deletions
|
@ -133,13 +133,16 @@ Core::Network::SapphireAPI::createCharacter( const int& accountId, const std::st
|
||||||
|
|
||||||
for( auto& v : json["content"] )
|
for( auto& v : json["content"] )
|
||||||
{
|
{
|
||||||
for( auto& vs : v )
|
if( v.is_array() )
|
||||||
{
|
{
|
||||||
tmpVector.push_back( vs.get< int >() );
|
for( auto& vs : v )
|
||||||
|
{
|
||||||
|
tmpVector.push_back( std::stoi( std::string( vs ) ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !v.empty() )
|
if( !v.empty() && !v.is_array() )
|
||||||
tmpVector2.push_back( v.get< int >() );
|
tmpVector2.push_back( std::stoi( std::string( v ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// leaving this in for now for reference
|
// leaving this in for now for reference
|
||||||
|
|
|
@ -488,9 +488,7 @@ void checkSession( shared_ptr< HttpServer::Response > response, shared_ptr< Http
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::string json_string = nlohmann::json( {
|
std::string json_string = nlohmann::json( {
|
||||||
{ "result", result },
|
{ "result", result }
|
||||||
{ "result2", "penis" },
|
|
||||||
{ "result3", "wtf" }
|
|
||||||
} ).dump()
|
} ).dump()
|
||||||
;
|
;
|
||||||
*response << buildHttpResponse( 200, json_string, JSON );
|
*response << buildHttpResponse( 200, json_string, JSON );
|
||||||
|
|
|
@ -143,7 +143,7 @@ uint32_t Core::Network::RestConnector::getNextCharId()
|
||||||
|
|
||||||
if( content.find( "invalid" ) == std::string::npos )
|
if( content.find( "invalid" ) == std::string::npos )
|
||||||
{
|
{
|
||||||
return json["result"].get< uint32_t >();
|
return std::stoi( std::string( json["result"] ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -182,7 +182,7 @@ uint64_t Core::Network::RestConnector::getNextContentId()
|
||||||
|
|
||||||
if( content.find( "invalid" ) == std::string::npos )
|
if( content.find( "invalid" ) == std::string::npos )
|
||||||
{
|
{
|
||||||
return json["result"].get< uint64_t >();
|
return std::stoll( std::string( json["result"] ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -313,7 +313,7 @@ int Core::Network::RestConnector::createCharacter( char* sId, std::string name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if( content.find( "invalid" ) == std::string::npos )
|
if( content.find( "invalid" ) == std::string::npos )
|
||||||
return json["result"].get< int >();
|
return std::stoi( json["result"].get< std::string >() );
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue