i965/fs: Don't segfault when debug-logging a null program
authorJason Ekstrand <jason.ekstrand@intel.com>
Fri, 29 Aug 2014 18:23:55 +0000 (11:23 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 Sep 2014 19:33:13 +0000 (12:33 -0700)
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs.cpp

index 268f52891c269d1d43c3e70173f7a8f972560920..ac6b1060ecf918d375b360f2aba692f4373cf840 100644 (file)
@@ -3234,7 +3234,7 @@ fs_visitor::run()
       if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) {      \
          char filename[64];                                                \
          snprintf(filename, 64, "fs%d-%04d-%02d-%02d-" #pass,              \
-                  dispatch_width, shader_prog->Name, iteration, pass_num); \
+                  dispatch_width, shader_prog ? shader_prog->Name : 0, iteration, pass_num); \
                                                                            \
          backend_visitor::dump_instructions(filename);                     \
       }                                                                    \
@@ -3245,7 +3245,7 @@ fs_visitor::run()
       if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
          char filename[64];
          snprintf(filename, 64, "fs%d-%04d-00-start",
-                  dispatch_width, shader_prog->Name);
+                  dispatch_width, shader_prog ? shader_prog->Name : 0);
 
          backend_visitor::dump_instructions(filename);
       }