commit c8dbce40e08334a3acefd172247b50db92f3d511
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sat Nov 7 21:37:05 2020 +0100

    Minor.

diff --git a/src/main/java/org/distorted/library/main/DistortedLibrary.java b/src/main/java/org/distorted/library/main/DistortedLibrary.java
index d7b1dc8..e446c0a 100644
--- a/src/main/java/org/distorted/library/main/DistortedLibrary.java
+++ b/src/main/java/org/distorted/library/main/DistortedLibrary.java
@@ -1048,37 +1048,10 @@ public class DistortedLibrary
     {
     InternalObject.onPause();
     Dynamic.onPause();
+
     mLinkedListSSBO[0]= -1;
     mAtomicCounter = null;
 
-    mFullProgram        = null;
-    mNormalProgram      = null;
-    mOITRenderProgram   = null;
-    mOITCollapseProgram = null;
-    mOITBuildProgram    = null;
-    mOITClearProgram    = null;
-    }
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-/**
- * Call this so that the Library can release its internal data structures.
- * Must be called from Activity.onDestroy(). 
- */
-  public static void onDestroy()
-    {
-    InternalObject.onDestroy();
-    InternalNodeData.onDestroy();
-    InternalMaster.onDestroy();
-    InternalOutputSurface.onDestroy();
-    DistortedEffects.onDestroy();
-    EffectQueue.onDestroy();
-    Effect.onDestroy();
-    DeferredJobs.onDestroy();
-    EffectMessageSender.stopSending();
-
-    mInitialized = false;
-    mOITCompilationAttempted = false;
-
     mNormalProgram     = null;
     mMainOITProgram    = null;
     mMainProgram       = null;
@@ -1091,6 +1064,30 @@ public class DistortedLibrary
     mBlitProgram       = null;
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Call this so that the Library can release its internal data structures.
+ * Must be called from Activity.onDestroy(). 
+ */
+  public static void onDestroy()
+    {
+    if( mInitialized )
+      {
+      mInitialized = false;
+      mOITCompilationAttempted = false;
+
+      InternalObject.onDestroy();
+      InternalNodeData.onDestroy();
+      InternalMaster.onDestroy();
+      InternalOutputSurface.onDestroy();
+      DistortedEffects.onDestroy();
+      EffectQueue.onDestroy();
+      Effect.onDestroy();
+      DeferredJobs.onDestroy();
+      EffectMessageSender.stopSending();
+      }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 /**
  * Return the maximum size of the texture supported by the driver.
