File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -2215,6 +2215,11 @@ def sample_buffer(*args)
2215
2215
def sample_duration ( *args )
2216
2216
filts_and_sources , args_a = sample_split_filts_and_opts ( args )
2217
2217
path = resolve_sample_path ( filts_and_sources )
2218
+
2219
+ if path . nil?
2220
+ raise ArgumentError . new ( "Error calling sample_duration: filters matched no samples" )
2221
+ end
2222
+
2218
2223
dur = load_sample_at_path ( path ) . duration
2219
2224
args_h = merge_synth_arg_maps_array ( args_a )
2220
2225
Original file line number Diff line number Diff line change @@ -50,5 +50,10 @@ def test_should_trigger
50
50
assert_equal ( true , @mock_sound . should_trigger? ( h ) )
51
51
end
52
52
53
+ def test_sample_duration
54
+ @mock_sound . stub :resolve_sample_path , nil do
55
+ assert_raises ( ArgumentError ) { @mock_sound . sample_duration ( [ "a/directory" , "bogus_file_name" ] ) }
56
+ end
57
+ end
53
58
end
54
59
end
You can’t perform that action at this time.
0 commit comments