mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
fix possible crash when reading border style, fix onLogin event
This commit is contained in:
@@ -122,8 +122,11 @@ void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode)
|
||||
setFixedSize(node->value<bool>());
|
||||
else if(node->tag() == "border") {
|
||||
auto split = Fw::split(node->value(), " ");
|
||||
setBorderWidth(Fw::safeCast<int>(split[0]));
|
||||
setBorderColor(Fw::safeCast<Color>(split[1]));
|
||||
if(split.size() == 2) {
|
||||
setBorderWidth(Fw::safeCast<int>(split[0]));
|
||||
setBorderColor(Fw::safeCast<Color>(split[1]));
|
||||
} else
|
||||
throw OTMLException(node, "border param must have its width followed by its color");
|
||||
}
|
||||
else if(node->tag() == "border-width")
|
||||
setBorderWidth(node->value<int>());
|
||||
|
@@ -1111,7 +1111,7 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
|
||||
creature->setDirection(direction);
|
||||
|
||||
// now that the local player is known, we can schedule login event
|
||||
if(creature == m_localPlayer) {
|
||||
if(creature == m_localPlayer && !m_localPlayer->isKnown()) {
|
||||
m_localPlayer->setKnown(true);
|
||||
g_dispatcher.addEvent([] { g_game.processLogin(); });
|
||||
}
|
||||
|
Reference in New Issue
Block a user