Skip to content

Commit 2ffb0ee

Browse files
fix: fix cases where SavedSubsystem should be nothing
1 parent 9ee2af8 commit 2ffb0ee

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/solutions/save_idxs.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,21 @@ end
110110
SavedSubsystem(indp, pobj, ::Nothing) = nothing
111111

112112
function SavedSubsystem(indp, pobj, idx::Int)
113+
_indp = get_root_indp(indp)
114+
if indp === EMPTY_SYMBOLCACHE || indp === nothing
115+
return nothing
116+
end
113117
state_map = Dict(1 => idx)
114118
return SavedSubsystem(state_map, nothing, nothing, nothing, nothing, nothing, nothing)
115119
end
116120

117121
function SavedSubsystem(indp, pobj, saved_idxs::Union{Array, Tuple})
118122
_indp = get_root_indp(indp)
119-
if indp === EMPTY_SYMBOLCACHE || indp === nothing
123+
if _indp === EMPTY_SYMBOLCACHE || _indp === nothing
120124
return nothing
121125
end
122126
if eltype(saved_idxs) == Int
123-
state_map = Dict{Int, Int}(k => v for (k, v) in enumerate(saved_idxs))
127+
state_map = Dict{Int, Int}(v => k for (k, v) in enumerate(saved_idxs))
124128
return SavedSubsystem(state_map, nothing, nothing, nothing, nothing, nothing, nothing)
125129
end
126130

0 commit comments

Comments
 (0)