Browse Source

Fix crash when using TextGraphic in texts

rdb 9 years ago
parent
commit
54819dbcde
1 changed files with 22 additions and 20 deletions
  1. 22 20
      panda/src/text/textAssembler.cxx

+ 22 - 20
panda/src/text/textAssembler.cxx

@@ -544,32 +544,34 @@ assemble_text() {
       }
     }
 
-    if (properties->has_shadow()) {
-      if (_dynamic_merge) {
-        if (placement._glyph->has_quad()) {
-          placement.assign_quad_to(quad_shadow_map, shadow_state, shadow);
+    if (!placement._glyph.is_null()) {
+      if (properties->has_shadow()) {
+        if (_dynamic_merge) {
+          if (placement._glyph->has_quad()) {
+            placement.assign_quad_to(quad_shadow_map, shadow_state, shadow);
+          } else {
+            placement.assign_append_to(geom_shadow_collector_map, shadow_state, shadow);
+          }
         } else {
-          placement.assign_append_to(geom_shadow_collector_map, shadow_state, shadow);
+          placement.assign_to(shadow_geom_node, shadow_state, shadow);
         }
-      } else {
-        placement.assign_to(shadow_geom_node, shadow_state, shadow);
-      }
 
-      // Don't shadow the graphics.  That can result in duplication of button
-      // objects, plus it looks weird.  If you want a shadowed graphic, you
-      // can shadow it yourself before you add it.
-      // placement.copy_graphic_to(shadow_node, shadow_state, shadow);
-      any_shadow = true;
-    }
+        // Don't shadow the graphics.  That can result in duplication of button
+        // objects, plus it looks weird.  If you want a shadowed graphic, you
+        // can shadow it yourself before you add it.
+        // placement.copy_graphic_to(shadow_node, shadow_state, shadow);
+        any_shadow = true;
+      }
 
-    if (_dynamic_merge) {
-      if (placement._glyph->has_quad()) {
-        placement.assign_quad_to(quad_map, text_state);
+      if (_dynamic_merge) {
+        if (placement._glyph->has_quad()) {
+          placement.assign_quad_to(quad_map, text_state);
+        } else {
+          placement.assign_append_to(geom_collector_map, text_state);
+        }
       } else {
-        placement.assign_append_to(geom_collector_map, text_state);
+        placement.assign_to(text_geom_node, text_state);
       }
-    } else {
-      placement.assign_to(text_geom_node, text_state);
     }
     placement.copy_graphic_to(text_node, text_state);
   }