From f056131ae1d2e5d1a37a42b3740f766cb77adfc7 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Wed, 8 Feb 2012 11:44:06 -0200 Subject: [PATCH] fix possible crash when reading border style, fix onLogin event --- TODO | 3 --- src/framework/ui/uiwidgetbasestyle.cpp | 7 +++++-- src/otclient/net/protocolgameparse.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index e4c9a02c..84e06db2 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,11 @@ ==================================================== High priority TODO in order (before first public disclose) -restore map moving multiline text edit remove UIGame move windows, navigate in containers complete miniwindow (close, minimize, resize, move) create and bind all game functions/events -let windows stay open while playing -combat controls player status icons (poison, etc) load modules from zip files display exit box when exiting from game diff --git a/src/framework/ui/uiwidgetbasestyle.cpp b/src/framework/ui/uiwidgetbasestyle.cpp index 65a00841..4e175c0f 100644 --- a/src/framework/ui/uiwidgetbasestyle.cpp +++ b/src/framework/ui/uiwidgetbasestyle.cpp @@ -122,8 +122,11 @@ void UIWidget::parseBaseStyle(const OTMLNodePtr& styleNode) setFixedSize(node->value()); else if(node->tag() == "border") { auto split = Fw::split(node->value(), " "); - setBorderWidth(Fw::safeCast(split[0])); - setBorderColor(Fw::safeCast(split[1])); + if(split.size() == 2) { + setBorderWidth(Fw::safeCast(split[0])); + setBorderColor(Fw::safeCast(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()); diff --git a/src/otclient/net/protocolgameparse.cpp b/src/otclient/net/protocolgameparse.cpp index 995d4c03..56102c98 100644 --- a/src/otclient/net/protocolgameparse.cpp +++ b/src/otclient/net/protocolgameparse.cpp @@ -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(); }); }