Code

* closes #508
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 Jul 2008 09:02:48 +0000 (09:02 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 21 Jul 2008 09:02:48 +0000 (09:02 +0000)
* catching an error

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11724 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/server/events/gosaTriggered.pm

index 6d969a18094412354ae8f7bc803f8b18180d6c9c..495f4ce4016f3ae24c59813091ef416696df9964 100644 (file)
@@ -298,15 +298,19 @@ sub ping {
             usleep(100000);
         }
 
-        my $answer_xml = @{@$res[0]}[3];
-        my %data = ( 'answer_xml'  => 'bin noch da' );
-        $answer_msg = &build_msg("got_ping", $target, $source, \%data);
-        my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
-        if (defined $forward_to_gosa){
-            $answer_msg =~s/<\/xml>/<forward_to_gosa>$forward_to_gosa<\/forward_to_gosa><\/xml>/;
+        # if an answer to the question exists
+        if (defined $message_id) {
+            my $answer_xml = @{@$res[0]}[3];
+            my %data = ( 'answer_xml'  => 'bin noch da' );
+            $answer_msg = &build_msg("got_ping", $target, $source, \%data);
+            my $forward_to_gosa = @{$msg_hash->{'forward_to_gosa'}}[0];
+            if (defined $forward_to_gosa){
+                $answer_msg =~s/<\/xml>/<forward_to_gosa>$forward_to_gosa<\/forward_to_gosa><\/xml>/;
+            }
+            $sql = "DELETE FROM $main::incoming_tn WHERE id=$message_id"; 
+            $res = $main::incoming_db->exec_statement($sql);
         }
-        $sql = "DELETE FROM $main::incoming_tn WHERE id=$message_id"; 
-        $res = $main::incoming_db->exec_statement($sql);
+
     }
 
     return ( $answer_msg );