diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-07-11 19:52:52 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-07-12 10:46:57 +0200 |
commit | 61618141f0204ce6653354f6424e11276d939aed (patch) | |
tree | 7deb56488bce8a899dfbf391ee845773ae1094f2 /nlpsolver | |
parent | de311257e851f1fdbc87a4df836a526220c668d0 (diff) |
cid#1487032 NP: Null pointer dereference
and
cid#1487033 UwF: Unwritten field
since...
commit 822f128e734f37ee4de9bf5b62640cbec140701e
Date: Wed Jul 7 16:01:19 2021 +0300
Polymorphism is a better approach when there are chains of inheritance.
where deGTBehavior and psGTBehavior are no longer stored when set from
DEPSSolverImpl.java:146 and DEPSSolverImpl.java:147
Change-Id: If3d228bf6e5f2b1ddd119d75b55bd778bcce8b05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118759
Tested-by: Jenkins
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'nlpsolver')
-rw-r--r-- | nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java index 88aa56eff837..adc6a75bd4f4 100644 --- a/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java +++ b/nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java @@ -101,6 +101,17 @@ public class DEPSAgent implements ILibEngine { public void setGTBehavior(AbsGTBehavior gtBehavior) { gtBehavior.setMemPoints(pbest_t, pcurrent_t, pold_t); + + // see getGTBehavior and setLibrary for uses of + // deGTBehavior and psGTBehavior + if (gtBehavior instanceof DEGTBehavior) { + deGTBehavior = ((DEGTBehavior) gtBehavior); + return; + } + if (gtBehavior instanceof PSGTBehavior) { + psGTBehavior = ((PSGTBehavior) gtBehavior); + return; + } } public void generatePoint() { |