Skip to content

Commit a06c2e2

Browse files
committed
added in a bool to avoid trying to save data when it does not exist
1 parent a7ed8ab commit a06c2e2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Base.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,9 @@ function postProcess!(n;kwargs...)
858858
n.r.ocp.tst = n.r.ocp.tctr
859859
end
860860

861+
stateDataExists = false
861862
if n.r.ocp.status==:Optimal || (!n.s.mpc.onlyOptimal && n.s.mpc.on && isequal(n.mpc.v.evalNum,1))
863+
stateDataExists = true
862864
if (!isequal(n.r.ocp.status,:Optimal) && n.s.mpc.on && isequal(n.mpc.v.evalNum,1))
863865
warn("There is no previous :Optimal solution to use since isequal(n.mpc.v.evalNum,1). \n
864866
Attemting to extract: ",n.r.ocp.status," solution. \n
@@ -944,7 +946,7 @@ function postProcess!(n;kwargs...)
944946
end
945947
end
946948
end
947-
if n.s.ocp.save
949+
if n.s.ocp.save && stateDataExists
948950
push!(n.r.ocp.dfs,dvs2dfs(n))
949951
push!(n.r.ocp.dfsCon,con2dfs(n))
950952
if n.s.ocp.interpolationOn

0 commit comments

Comments
 (0)