Skip to content

Instantly share code, notes, and snippets.

@kahrl
Created September 12, 2014 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kahrl/b4a0337320beeaa48227 to your computer and use it in GitHub Desktop.
Save kahrl/b4a0337320beeaa48227 to your computer and use it in GitHub Desktop.
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 4b1beb2..4766524 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -938,7 +938,7 @@ void Inventory::deSerialize(std::istream &is)
}
else
{
- throw SerializationError("invalid inventory specifier");
+ throw SerializationError("invalid inventory specifier: " + name);
}
}
}
diff --git a/src/server.cpp b/src/server.cpp
index 40857f8..cd506a5 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -1169,10 +1169,15 @@ PlayerSAO* Server::StageTwoClientInit(u16 peer_id)
std::string playername = "";
PlayerSAO *playersao = NULL;
m_clients.Lock();
- RemoteClient* client = m_clients.lockedGetClientNoEx(peer_id, CS_InitDone);
- if (client != NULL) {
- playername = client->getName();
- playersao = emergePlayer(playername.c_str(), peer_id);
+ try {
+ RemoteClient* client = m_clients.lockedGetClientNoEx(peer_id, CS_InitDone);
+ if (client != NULL) {
+ playername = client->getName();
+ playersao = emergePlayer(playername.c_str(), peer_id);
+ }
+ } catch (std::exception &e) {
+ m_clients.Unlock();
+ throw;
}
m_clients.Unlock();
@@ -3853,7 +3858,7 @@ void Server::SendBlocks(float dtime)
RemoteClient *client = m_clients.lockedGetClientNoEx(*i, CS_Active);
if (client == NULL)
- return;
+ continue;
total_sending += client->SendingCount();
client->GetNextBlocks(m_env,m_emerge, dtime, queue);
diff --git a/src/settings.cpp b/src/settings.cpp
index 46b84d1..decb54e 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -61,9 +61,9 @@ bool Settings::parseConfigLines(std::istream &is,
JMutexAutoLock lock(m_mutex);
std::string name, value;
- bool end_found;
+ bool end_found = false;
- while (is.good()) {
+ while (is.good() && !end_found) {
if (parseConfigObject(is, name, value, end, end_found)) {
m_settings[name] = value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment