Fixed a crash when files.bbs had empty lines

This commit is contained in:
Michiel Broek 2005-12-23 15:15:55 +00:00
parent f181e793d9
commit 244dd30448
2 changed files with 21 additions and 0 deletions

View File

@ -2,6 +2,9 @@ $Id$
v0.83.6 17-Dec-2005 v0.83.6 17-Dec-2005
mbfile:
Fixed a crash when files.bbs had empty lines.
mbtask: mbtask:
Better messages during servers connections reset. Better messages during servers connections reset.

View File

@ -115,6 +115,24 @@ void ImportFiles(int Area)
while (fgets(String, 4095, fbbs) != NULL) { while (fgets(String, 4095, fbbs) != NULL) {
/*
* Strip cr and lf characters
*/
for (i = 0; i < strlen(String); i++) {
if (*(String + i) == '\0')
break;
if (*(String + i) == '\n')
*(String + i) = '\0';
if (*(String + i) == '\r')
*(String + i) = '\0';
}
/*
* Stop on an empty line
*/
if (strlen(String) == 0)
break;
if ((String[0] != ' ') && (String[0] != '\t')) { if ((String[0] != ' ') && (String[0] != '\t')) {
/* /*
* New file entry, check if there has been a file that is not yet saved. * New file entry, check if there has been a file that is not yet saved.