Skip to content

Commit

Permalink
Merge pull request #103 from SebastianM-C/smc/fix
Browse files Browse the repository at this point in the history
Fix possible `StackOverflowError`s for `remake_buffer` & `InitializationProblem`s
  • Loading branch information
AayushSabharwal authored Oct 16, 2024
2 parents 1e08e11 + 8f9fa49 commit 7b37511
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/remake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ function remake_buffer(sys, oldbuffer::AbstractArray, idxs, vals)
return newbuffer
end

remake_buffer(sys, ::Nothing, idxs, vals) = nothing

function remake_buffer(sys, oldbuffer, idxs, vals)
remake_buffer(sys, oldbuffer, Dict(idxs .=> vals))
end
Expand Down
2 changes: 2 additions & 0 deletions test/remake_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,5 @@ for (buf, newbuf, idxs, vals) in [
@test newbuf == _newbuf # test values
@test typeof(newbuf) == typeof(_newbuf) # ensure appropriate type
end

@test isnothing(remake_buffer(sys, nothing, [], []))

0 comments on commit 7b37511

Please sign in to comment.