Release 18.03
diff --git a/ArmnnDriver.cpp b/ArmnnDriver.cpp
index 914d656..1962464 100644
--- a/ArmnnDriver.cpp
+++ b/ArmnnDriver.cpp
@@ -372,6 +372,19 @@
         return FailPrepareModel(ErrorStatus::GENERAL_FAILURE, message.str(), cb);
     }
 
+    // Check that the optimized network is valid.
+    if (!optNet)
+    {
+        return FailPrepareModel(ErrorStatus::GENERAL_FAILURE,
+            "ArmnnDriver::prepareModel: Invalid optimized network", cb);
+    }
+
+    // Export the optimized network graph to a dot file if an output dump directory
+    // has been specified in the drivers' arguments.
+    ExportNetworkGraphToDotFile(*optNet,
+                                m_Options.GetRequestInputsAndOutputsDumpDir(),
+                                model);
+
     // load it into the runtime
     armnn::NetworkId netId = 0;
     try