← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2668: Crash when hubs are not yet available

 

------------------------------------------------------------
revno: 2668
fixes bug: https://launchpad.net/bugs/880312
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Mon 2011-11-07 21:42:34 +0100
message:
  Crash when hubs are not yet available
modified:
  win32/PrivateFrame.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp	2011-10-30 14:24:14 +0000
+++ win32/PrivateFrame.cpp	2011-11-07 20:42:34 +0000
@@ -319,7 +319,9 @@
 }
 
 void PrivateFrame::sendMessage(const tstring& msg, bool thirdPerson) {
-	auto url = hubs[hubBox->getSelected()].first;
+	auto sel = hubBox->getSelected();
+
+	auto &url = sel >= 0 && static_cast<size_t>(sel) < hubs.size() ? hubs[static_cast<size_t>(sel)].first : replyTo.getUser().hint;
 	ClientManager::getInstance()->privateMessage(HintedUser(replyTo.getUser().user, url), Text::fromT(msg), thirdPerson);
 }