diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-28 03:01:33 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-28 03:01:33 +0400 |
commit | f9ae102afd4a6dd03a028127c2e2b4f99ae8cf57 (patch) | |
tree | 9822c0a276413a7bcca2615c7c451d5449a56b65 /source | |
parent | f0a3cbcdac4c7f84daef7c33e858a10277400a5f (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 3 | ||||
-rw-r--r-- | source/blender/src/editfont.c | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 876547042dc..53b7bb975a3 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -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; diff --git a/source/blender/src/editfont.c b/source/blender/src/editfont.c index cb245867c89..a3b05a008c8 100644 --- a/source/blender/src/editfont.c +++ b/source/blender/src/editfont.c @@ -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; |