[Mesa-dev] [PATCH 2/2] glsl: Don't choke when printing an anonymous function parameter

Ian Romanick idr at freedesktop.org
Fri Jun 24 17:35:11 PDT 2011


From: Ian Romanick <ian.d.romanick at intel.com>

NOTE: This is a candidate for the 7.10 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38584
---
 src/glsl/ir_print_visitor.cpp |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/glsl/ir_print_visitor.cpp b/src/glsl/ir_print_visitor.cpp
index 5b5409d..5248330 100644
--- a/src/glsl/ir_print_visitor.cpp
+++ b/src/glsl/ir_print_visitor.cpp
@@ -96,6 +96,13 @@ void ir_print_visitor::indent(void)
 const char *
 ir_print_visitor::unique_name(ir_variable *var)
 {
+   /* var can be NULL in function prototypes when a type is given for
+    * a parameter but no name is given.  In that case, just return an
+    * empty string.
+    */
+   if (var == NULL)
+      return "";
+
    /* Do we already have a name for this variable? */
    const char *name = (const char *) hash_table_find(this->printable_names, var);
    if (name != NULL)
-- 
1.7.4.4



More information about the mesa-dev mailing list