i965/vec4: Don't segfault when debug-logging a null program
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 28 Aug 2014 04:49:50 +0000 (21:49 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 Sep 2014 19:31:56 +0000 (12:31 -0700)
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4.cpp

index acf0b6390bcdfcb2f694ac3e45911fa934e51811..b247bf7532b7a81f9285464a7b1ae1803aee3a85 100644 (file)
@@ -1778,7 +1778,7 @@ vec4_visitor::run()
       if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER) && this_progress) {  \
          char filename[64];                                            \
          snprintf(filename, 64, "%s-%04d-%02d-%02d-" #pass,            \
-                  stage_name, shader_prog->Name, iteration, pass_num); \
+                  stage_name, shader_prog ? shader_prog->Name : 0, iteration, pass_num); \
                                                                        \
          backend_visitor::dump_instructions(filename);                 \
       }                                                                \
@@ -1790,7 +1790,7 @@ vec4_visitor::run()
    if (unlikely(INTEL_DEBUG & DEBUG_OPTIMIZER)) {
       char filename[64];
       snprintf(filename, 64, "%s-%04d-00-start",
-               stage_name, shader_prog->Name);
+               stage_name, shader_prog ? shader_prog->Name : 0);
 
       backend_visitor::dump_instructions(filename);
    }