We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7e3c90e commit bc5d0aeCopy full SHA for bc5d0ae
app/server/core.rb
@@ -184,6 +184,7 @@ def self.reset_all
184
module SonicPi
185
module Core
186
class EmptyVectorError < StandardError ; end
187
+ class InvalidIndexError < StandardError ; end
188
189
class SPVector < Hamster::Vector
190
include TLMixin
@@ -201,6 +202,7 @@ def ___sp_preserve_vec_kind(a)
201
202
end
203
204
def [](idx, len=(missing_length = true))
205
+ raise InvalidIndexError, "Invalid index: #{idx.inspect}, was expecting a number or range" unless idx && (idx.is_a?(Numeric) || idx.is_a?(Range))
206
if idx.is_a?(Numeric) && missing_length
207
idx = map_index(idx)
208
super idx
0 commit comments