Skip to content

Commit

Permalink
Fix a few issues found by JET (#1510)
Browse files Browse the repository at this point in the history
The first two are to handle `nothing`. The replacement of `outflow_ids`
is just an optimization.
  • Loading branch information
visr authored Jun 3, 2024
1 parent 3a443e9 commit 5c592ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ function continuous_control!(
if controls_pump
for id in outflow_ids(graph, controlled_node_id)
if id in fractional_flow.node_id
after_ff_id = outflow_ids(graph, id)
ff_idx = findsorted(fractional_flow, id)
ff_idx = findsorted(fractional_flow.node_id, id)
after_ff_id = fractional_flow.outflow_edge[ff_idx].edge[2]
flow_rate_fraction = fractional_flow.fraction[ff_idx] * flow_rate
flow[id, after_ff_id] = flow_rate_fraction

Expand Down
4 changes: 2 additions & 2 deletions core/src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function pkgversion(m::Module)::VersionNumber
# If it returns `nothing`, we try a different way
rootmodule = Base.moduleroot(m)
pkg = Base.PkgId(rootmodule)
pkgorigin = get(Base.pkgorigins, pkg, nothing)
pkgorigin = Base.pkgorigins[pkg]
return pkgorigin.version
end

Expand Down Expand Up @@ -688,7 +688,7 @@ end
function get_influx(basin::Basin, node_id::NodeID)::Float64
has_index, basin_idx = id_index(basin.node_id, node_id)
if !has_index
error("Sum of vertical fluxes requested for non-basin $id.")
error("Sum of vertical fluxes requested for non-basin $node_id.")
end
return get_influx(basin, basin_idx)
end
Expand Down

0 comments on commit 5c592ef

Please sign in to comment.