From e408dd8be1c4a8257be58d08ab0e5c9714c5c14f Mon Sep 17 00:00:00 2001 From: Pascal Muetschard Date: Fri, 15 Apr 2022 10:38:15 -0700 Subject: [PATCH] Be more robust in the ShaderView for null resources. --- .../com/google/gapid/views/ShaderView.java | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/gapic/src/main/com/google/gapid/views/ShaderView.java b/gapic/src/main/com/google/gapid/views/ShaderView.java index 9417460c7..0cb6c2200 100644 --- a/gapic/src/main/com/google/gapid/views/ShaderView.java +++ b/gapic/src/main/com/google/gapid/views/ShaderView.java @@ -123,7 +123,7 @@ public static class ShaderWidget extends Composite { private final TabFolder tabFolder; private final Composite sourceContainer; private final Group statGroup; - private final TableViewer statTable; + protected final TableViewer statTable; private final GridData crossCompileGridData; private final SourceViewer spirvViewer; private final SourceViewer sourceViewer; @@ -281,19 +281,22 @@ protected void onUiThread(API.Shader result) { } public void setShader(Service.Resource resource, API.Shader shader) { - rpcController.start().listen(models.resources.loadResourceExtras(resource), - new UiCallback(this, LOG) { - @Override - protected API.ShaderExtras onRpcThread(Rpc.Result result) - throws RpcException, ExecutionException { - return result.get().getShaderExtras(); - } + if (resource != null) { + rpcController.start().listen(models.resources.loadResourceExtras(resource), + new UiCallback(this, LOG) { + @Override + protected API.ShaderExtras onRpcThread(Rpc.Result result) + throws RpcException, ExecutionException { + return result.get().getShaderExtras(); + } + + @Override + protected void onUiThread(API.ShaderExtras result) { + statTable.setInput(result.getStaticAnalysis()); + } + }); + } - @Override - protected void onUiThread(API.ShaderExtras result) { - statTable.setInput(result.getStaticAnalysis()); - } - }); loading.stopLoading(); shaderResource = resource;