From feb0d1d698ee827c181fb199a341410db7577a29 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 30 Dec 2012 18:17:20 +0000 Subject: [PATCH] Fix crash in syntax color code when drawing a text editor with no text. --- source/blender/editors/space_text/text_draw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index a5e81ecd535..11a5687915b 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1275,7 +1275,7 @@ static void draw_brackets(SpaceText *st, ARegion *ar) void draw_text_main(SpaceText *st, ARegion *ar) { Text *text = st->text; - TextFormatType *tft = ED_text_format_get(text); + TextFormatType *tft; TextLine *tmp; rcti scroll, back; char linenr[12]; @@ -1303,6 +1303,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */ /* update syntax formatting if needed */ + tft = ED_text_format_get(text); tmp = text->lines.first; lineno = 0; for (i = 0; i < st->top && tmp; i++) {