Fix a possible NullPointerException

Change-Id: Ifc7169b2757e81416785ec083f201e93a3c7580b
diff --git a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
index 58c9d49..dcd97bf 100644
--- a/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
+++ b/apps/optical-model/src/main/java/org/onosproject/net/optical/intent/impl/compiler/OpticalConnectivityIntentCompiler.java
@@ -394,7 +394,8 @@
                 }
 
                 Annotations annotations = edge.link().annotations();
-                if (annotations != null && !annotations.value("metric").isEmpty()) {
+                if (annotations != null &&
+                        annotations.value("metric") != null && !annotations.value("metric").isEmpty()) {
                     double metric = Double.parseDouble(annotations.value("metric"));
                     return ScalarWeight.toWeight(metric);
                 } else {