diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp
index 982136128e41ef8f67e5d3ebf7a23ded2cf82c73..645fcf7b46e284dc3dc9791593854c2383bb28a7 100644
--- a/indra/llprimitive/llmaterial.cpp
+++ b/indra/llprimitive/llmaterial.cpp
@@ -76,6 +76,17 @@ template<typename T> T getMaterialField(const LLSD& data, const std::string& fie
 	return (T)LLSD();
 }
 
+// GCC didn't like the generic form above for some reason
+template<> LLUUID getMaterialField(const LLSD& data, const std::string& field, const LLSD::Type field_type)
+{
+	if ( (data.has(field)) && (field_type == data[field].type()) )
+	{
+		return data[field].asUUID();
+	}
+	llerrs << "Missing or mistyped field '" << field << "' in material definition" << llendl;
+	return LLUUID::null;
+}
+
 /**
  * LLMaterial class
  */