Bugfix: Text Editor operators crash when invoked from Python/Console
authorJoshua Leung <aligorith@gmail.com>
Fri, 10 Jun 2011 12:08:55 +0000 (12:08 +0000)
committerJoshua Leung <aligorith@gmail.com>
Fri, 10 Jun 2011 12:08:55 +0000 (12:08 +0000)
source/blender/editors/space_text/text_draw.c

index 625e5561389399b51c48902956865ff30c9be5d3..28230b7a48b9d2ea2227c890e4ead7acd5a000df 100644 (file)
@@ -907,9 +907,12 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
 
 void text_drawcache_tag_update(SpaceText *st, int full)
 {
-       DrawCache *drawcache= (DrawCache *)st->drawcache;
-
-       if(drawcache) {
+       /* this happens if text editor ops are caled from python */
+       if (st == NULL)
+               return;
+               
+       if(st->drawcache) {
+               DrawCache *drawcache= (DrawCache *)st->drawcache;
                Text *txt= st->text;
 
                if(drawcache->update_flag) {