diff --git a/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs b/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs index 1ee630bc71..9397fdb913 100644 --- a/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs +++ b/Ryujinx.Graphics/Shader/StructuredIr/AstBlockVisitor.cs @@ -43,11 +43,15 @@ namespace Ryujinx.Graphics.Shader.StructuredIr BlockEntered?.Invoke(this, new BlockVisitationEventArgs(Block)); } - IAstNode next = Next(node); + //Node may be null, if the block is empty. + if (node != null) + { + IAstNode next = Next(node); - yield return node; + yield return node; - node = next; + node = next; + } //We reached the end of the list, go up on tree to the parent blocks. while (node == null && Block.Type != AstBlockType.Main)