bugfix, txt_to_buf would crash on an empty text file.

Also checked all other uses of text->lines.first to make sure the assumption isn't made elsewhere.
Added 2 more checks for text->lines.first when converting text buffer to objects.
This commit is contained in:
Campbell Barton 2008-06-27 23:01:33 +00:00
parent f0a3cbcdac
commit f9ae102afd
2 changed files with 4 additions and 3 deletions

@ -942,7 +942,8 @@ char *txt_to_buf (Text *text)
if (!text) return NULL;
if (!text->curl) return NULL;
if (!text->sell) return NULL;
if (!text->lines.first) return NULL;
linef= text->lines.first;
charf= 0;

@ -354,7 +354,7 @@ void txt_export_to_object(struct Text *text)
// char sdir[FILE_MAXDIR];
// char sfile[FILE_MAXFILE];
if(!text) return;
if(!text || !text->lines.first) return;
id = (ID *)text;
@ -429,7 +429,7 @@ void txt_export_to_objects(struct Text *text)
int linenum = 0;
float offset[3] = {0.0,0.0,0.0};
if(!text) return;
if(!text || !text->lines.first) return;
id = (ID *)text;