From 7613f18c7014b5681a5f1482901b3b00c8fb8bc5 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Tue, 5 Jan 2021 15:47:37 -0600 Subject: [PATCH] Fix `vector/_set` This makes it so that `vector/_set` returns `:ignore-instruction` if the given vector is empty. --- src/propeller/push/instructions/vector.cljc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/propeller/push/instructions/vector.cljc b/src/propeller/push/instructions/vector.cljc index b2df4da..8785159 100755 --- a/src/propeller/push/instructions/vector.cljc +++ b/src/propeller/push/instructions/vector.cljc @@ -211,8 +211,10 @@ (let [lit-stack (get-vector-literal-type stack)] (make-instruction state (fn [lit n vect] - (assoc vect (mod n (count vect)) lit)) - [:integer lit-stack stack] + (if (empty? vect) + :ignore-instruction + (assoc vect (mod n (count vect)) lit))) + [lit-stack :integer stack] stack)))) ;; Pushes a subvector of the top item, with start and end indices determined by