diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2020-09-08 14:48:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-08 14:48:05 -0400 |
| commit | 3a34db6e8864df51b9ae93fe46c6d98c4cfc77bb (patch) | |
| tree | 1e6c98f470e1300cb17f55e2cc1e9ff26fb87e9b /source/slang/slang-compiler.cpp | |
| parent | 8740252f04c4fe96c5d19a8f07cac43037087e15 (diff) | |
Test if blob is returned. (#1535)
Diffstat (limited to 'source/slang/slang-compiler.cpp')
| -rwxr-xr-x | source/slang/slang-compiler.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
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<ISlangBlob> 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<ISlangBlob> blob; if (SLANG_FAILED(result.getBlob(blob))) { + SLANG_UNEXPECTED("No blob to emit"); return; } |
