Fixed some NULL pointer references in callback handling.

ranzbak [2011-03-15 14:41]
Fixed some NULL pointer references in callback handling.

git-svn-id: https://old.setv.nl/svn/swarmtv@304 88541080-9ad6-de11-9093-5254007c1f44
Filename
trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c
trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c
trunk/swarmtv/shellfront/daemonize.c
trunk/swarmtv/shellfront/mailmsg.c
trunk/swarmtv/shellfront/swarmtv.c
diff --git a/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c b/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c
index 49ff892..0a24915 100644
--- a/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c
+++ b/trunk/swarmtv/libswarmtv/filehandler/nzb/findnzb.c
@@ -213,8 +213,12 @@ static int rsstcallnzbhandle(rsstor_handle *handle, char *torurl, char *name, ch
   nzb.filtername = filtername;
   nzb.metatype = "torrent";
   nzb.url = torurl;
-  nzb.metadata = buffer->memory;
-  nzb.metasize = buffer->size;
+  if(buffer != NULL) {
+    nzb.metadata = buffer->memory;
+    nzb.metasize = buffer->size;
+  } else {
+    rsstwritelog(LOG_ERROR, "No torrent-content for '%s' %s:%d", torurl, __FILE__, __LINE__);
+  }

   /*
    * Call the handler
diff --git a/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c b/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c
index 99bd61a..c36ec14 100644
--- a/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c
+++ b/trunk/swarmtv/libswarmtv/filehandler/torrent/findtorrent.c
@@ -458,8 +458,12 @@ static int rsstcalltorrenthandle(rsstor_handle *handle, char *torurl, char *name
   torrent.filtername = filtername;
   torrent.metatype = "torrent";
   torrent.url = torurl;
-  torrent.metadata = buffer->memory;
-  torrent.metasize = buffer->size;
+  if(buffer != NULL) {
+    torrent.metadata = buffer->memory;
+    torrent.metasize = buffer->size;
+  } else {
+    rsstwritelog(LOG_ERROR, "No torrent-content for '%s' %s:%d", torurl, __FILE__, __LINE__);
+  }

   /*
    * Call the handler
diff --git a/trunk/swarmtv/shellfront/daemonize.c b/trunk/swarmtv/shellfront/daemonize.c
index e052cd5..fe7ec86 100644
--- a/trunk/swarmtv/shellfront/daemonize.c
+++ b/trunk/swarmtv/shellfront/daemonize.c
@@ -31,7 +31,7 @@
 #ifdef __MINGW32__
 #include "../libswarmtv/types.h"
 #else
-#include "types.h".
+#include "types.h"
 #endif
 #include "config.h"

diff --git a/trunk/swarmtv/shellfront/mailmsg.c b/trunk/swarmtv/shellfront/mailmsg.c
index 26e5ab0..a7168e5 100644
--- a/trunk/swarmtv/shellfront/mailmsg.c
+++ b/trunk/swarmtv/shellfront/mailmsg.c
@@ -38,7 +38,7 @@
 #ifdef __MINGW32__
 #include "../libswarmtv/types.h"
 #else
-#include "types.h".
+#include "types.h"
 #endif
 #include "config.h"
 #include "logfile.h"
diff --git a/trunk/swarmtv/shellfront/swarmtv.c b/trunk/swarmtv/shellfront/swarmtv.c
index bea3c24..d0d6c5f 100644
--- a/trunk/swarmtv/shellfront/swarmtv.c
+++ b/trunk/swarmtv/shellfront/swarmtv.c
@@ -29,7 +29,7 @@
 #ifdef __MINGW32__
 #include "../libswarmtv/types.h"
 #else
-#include "types.h".
+#include "types.h"
 #endif
 #include "database.h"
 #include "logfile.h"