From f647448cbec068eaba4e37430bd64a885907898b Mon Sep 17 00:00:00 2001
From: Michiel Cottaar <michiel.cottaar@ndcn.ox.ac.uk>
Date: Thu, 15 Feb 2024 17:27:37 +0000
Subject: [PATCH] Do not add non-existing gradient block

---
 src/all_building_blocks/base_building_blocks.jl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/all_building_blocks/base_building_blocks.jl b/src/all_building_blocks/base_building_blocks.jl
index 47c440a..7aa5e80 100644
--- a/src/all_building_blocks/base_building_blocks.jl
+++ b/src/all_building_blocks/base_building_blocks.jl
@@ -113,7 +113,7 @@ function waveform_sequence(bb::BaseBuildingBlock, first, last)
     parts = Tuple{Any, GradientWaveform}[]
     for key in keys(bb)
         if bb[key] isa GradientWaveform
-            if started
+            if started && !isnothing(current_grad_key)
                 push!(parts, (current_grad_key, isnothing(current_start) ? bb[current_grad_key] : split_gradient(bb[current_grad_key], current_start)[2]))
             end
             current_grad_key = key
-- 
GitLab