]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/news.cpp
Fixed a core bug hopefully
[irc/gameservirc.git] / gameserv / news.cpp
index fa7fdb8ba8d4ac28e5d804e53624705a92c47c4c..df06e70a59237e5320871e4f3735baff1c83c261 100644 (file)
@@ -78,14 +78,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 +123,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;