modules_k/dialog: Enhance unref_dlg_from_cb() robustness.
authorTimo Reimann <timo.reimann@1und1.de>
Tue, 2 Nov 2010 18:06:12 +0000 (19:06 +0100)
committerTimo Reimann <timo.reimann@1und1.de>
Tue, 2 Nov 2010 18:08:11 +0000 (19:08 +0100)
- Check parameter for NULL pointer.
- Call unreference_dlg(), thus being more wrapper-ish.
- Fix indention.

modules_k/dialog/dlg_handlers.c

index ebed8a9..a118a91 100644 (file)
@@ -820,10 +820,13 @@ static void unreference_dialog(void *dialog)
  */
 static void unref_dlg_from_cb(struct cell* t, int type, struct tmcb_params *param)
 {
-    struct dlg_cell *dlg = (struct dlg_cell *)(*param->param);
+       struct dlg_cell *dlg = (struct dlg_cell *)(*param->param);
+
+       if (!dlg)
+               return;
 
        /* destroy dialog */
-    unref_dlg(dlg, 1);
+       unreference_dialog(dlg);
 }