Skip to content

Commit c1024f9

Browse files
author
Chris Hellmuth
committed
Compile with -Werror
1 parent ba3770e commit c1024f9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

source/MaterialXGenOslNodes/OslNodesShaderGenerator.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ShaderPtr OslNodesShaderGenerator::generate(const string& name, ElementPtr eleme
4545
ConstDocumentPtr document = element->getDocument();
4646

4747
string lastNodeName;
48-
ShaderOutput* lastOutput;
48+
ShaderOutput* lastOutput = nullptr;
4949
std::vector<string> connections;
5050

5151
std::set<std::string> osoPaths;
@@ -104,6 +104,11 @@ ShaderPtr OslNodesShaderGenerator::generate(const string& name, ElementPtr eleme
104104
lastNodeName = name;
105105
}
106106

107+
if (!lastOutput) {
108+
printf("Invalid shader\n");
109+
return nullptr;
110+
}
111+
107112
for (auto&& connect : connections) {
108113
emitLine(connect, stage, false);
109114
}

source/MaterialXGenOslNodes/OslNodesSyntax.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class OslNodesVectorTypeSyntax : public AggregateTypeSyntax
3232

3333
string result = "";
3434
string separator = "";
35-
for (int i = 0; i < c.numElements(); i++) {
35+
for (size_t i = 0; i < c.numElements(); i++) {
3636
result += separator;
3737
result += toValueString(c[i]);
3838

0 commit comments

Comments
 (0)