]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/news.cpp
First update in a while... added a couple includes to news.cpp and hash.cpp for picky...
[irc/gameservirc.git] / gameserv / news.cpp
index fa7fdb8ba8d4ac28e5d804e53624705a92c47c4c..3aff621f319a348a44725c3ebaeeb5c2cdc3e2fe 100644 (file)
@@ -1,5 +1,6 @@
 #include "extern.h"
 #include <fstream>
+#include <stdio.h>
 
 using std::ofstream;
 using std::ifstream;
@@ -78,14 +79,13 @@ void saveNews(char *filename, List<myString> &news)
 {
     ofstream outfile;
     outfile.open(filename);
+
     if (outfile.fail())
     {
        log("Error opening %s", filename);
        return;
     }
 
-    outfile << "";
-
     ListNode<myString> *it;
     it = news.First();
     while (it)
@@ -124,6 +124,11 @@ void loadNews(char *filename, List<myString> &news)
 
     while (infile.getline(buf, 1024, '\n'))
     {
+       if (buf[0] == '\0' || buf[0] == '\n')
+       {
+           delete [] buf;
+           return;
+       }
        string = new myString(buf);
        news.insertAtBack(string);
        delete string;