Fix crash in Viewer when attempting to view shaders in Metal.

Change-Id: Ia19063f13e74d7dc2f1ead1fad20ad6828a3648d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/298742
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
John Stiles 2020-06-24 11:01:08 -04:00 committed by Skia Commit-Bot
parent 72e576492c
commit 03b92cd667

View File

@ -2297,7 +2297,8 @@ void Viewer::drawImGui() {
SkSL::String highlight;
if (!sksl) {
highlight = shaderCaps->versionDeclString();
const char* versionDecl = shaderCaps->versionDeclString();
highlight = versionDecl ? versionDecl : "";
if (shaderCaps->usesPrecisionModifiers()) {
highlight.append("precision mediump float;\n");
}