fixed crash

This commit is contained in:
Patrick von Reth 2014-01-13 11:15:09 +01:00
parent 8d7626f950
commit b9f72387d5
1 changed files with 16 additions and 7 deletions

View File

@ -65,12 +65,20 @@ void SnarlNetworkFrontend::actionInvoked(Notification notification){
callback(sn,"SNP/1.1/302/Notification cancelled/"); callback(sn,"SNP/1.1/302/Notification cancelled/");
} }
} }
void SnarlNetworkFrontend::notificationClosed(Notification notification){ void SnarlNetworkFrontend::notificationClosed(Notification notification)
SnarlNotification sn=notifications.value(notification.id()); {
if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT) if(notifications.contains(notification.id()))
callback(sn,"SNP/1.1/303/Notification timed out/"); {
else SnarlNotification sn=notifications.value(notification.id());
callback(sn,"SNP/1.1/307/Notification closed/"); if(notification.closeReason() == NotificationEnums::CloseReasons::TIMED_OUT)
{
callback(sn,"SNP/1.1/303/Notification timed out/");
}
else
{
callback(sn,"SNP/1.1/307/Notification closed/");
}
}
} }
void SnarlNetworkFrontend::handleConnection(){ void SnarlNetworkFrontend::handleConnection(){
@ -108,7 +116,8 @@ void SnarlNetworkFrontend::handleMessages(){
} }
} }
void SnarlNetworkFrontend::callback(const SnarlNotification &sn,QString msg){ void SnarlNetworkFrontend::callback(const SnarlNotification &sn,QString msg)
{
notifications.remove(sn.notification.id()); notifications.remove(sn.notification.id());
if(sn.clientSocket!=NULL&&!msg.isEmpty()){ if(sn.clientSocket!=NULL&&!msg.isEmpty()){
msg+=QString::number(sn.notification.id()); msg+=QString::number(sn.notification.id());