[Libreoffice-commits] core.git: nlpsolver/ThirdParty

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 12 08:47:29 UTC 2021


 nlpsolver/ThirdParty/EvolutionarySolver/src/net/adaptivebox/deps/DEPSAgent.java |   11 ++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 61618141f0204ce6653354f6424e11276d939aed
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun Jul 11 19:52:52 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 12 10:46:57 2021 +0200

    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 at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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() {


More information about the Libreoffice-commits mailing list