From 3a34db6e8864df51b9ae93fe46c6d98c4cfc77bb Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 8 Sep 2020 14:48:05 -0400 Subject: Test if blob is returned. (#1535) --- source/slang/slang-compiler.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'source/slang/slang-compiler.cpp') diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp index 859da5d11..71582f60d 100755 --- a/source/slang/slang-compiler.cpp +++ b/source/slang/slang-compiler.cpp @@ -122,13 +122,17 @@ namespace Slang { switch(format) { - case ResultFormat::None: default: - break; - + case ResultFormat::None: + { + // If no blob is returned, it's an error + return SLANG_FAIL; + } case ResultFormat::Text: + { blob = StringUtil::createStringBlob(outputString); break; + } case ResultFormat::Binary: { if (downstreamResult) @@ -1968,7 +1972,11 @@ SlangResult dissassembleDXILUsingDXC( case ResultFormat::Binary: { ComPtr blob; - result.getBlob(blob); + if (SLANG_FAILED(result.getBlob(blob))) + { + SLANG_UNEXPECTED("No blob to emit"); + return; + } writeOutputFile(compileRequest, outputPath, blob->getBufferPointer(), @@ -2020,6 +2028,7 @@ SlangResult dissassembleDXILUsingDXC( ComPtr blob; if (SLANG_FAILED(result.getBlob(blob))) { + SLANG_UNEXPECTED("No blob to emit"); return; } -- cgit v1.2.3