diff --git a/examples/example.f90 b/examples/example.f90
index 1ced5659853a7ec04e75c3b3adc04f2403b4d753..6a3080575214844963b760aa9a7d2a9c6ec863a2 100644
--- a/examples/example.f90
+++ b/examples/example.f90
@@ -166,7 +166,11 @@ CONTAINS
     CALL deallocateTimedelta(mtime_td)
 
     mtime_td => newTimedelta("PT7536.0003S")
-    CALL timedeltatostring(mtime_td, td_string)
+    IF (ASSOCIATED(mtime_td)) THEN
+      CALL timedeltatostring(mtime_td, td_string)
+    ELSE
+      td_string = "<null>"
+    END IF
     WRITE (0, *) "PT7536.0003S (expect <null>) = ", TRIM(td_string)
     CALL deallocateTimedelta(mtime_td)
 
diff --git a/examples/repetitor.f90 b/examples/repetitor.f90
index 3ac9bc4a38a5c9b84906f86bb1dc2c39893cd0e6..d20d0d663fcf0fc79e6ec92ea45bd5132ed5e0e6 100644
--- a/examples/repetitor.f90
+++ b/examples/repetitor.f90
@@ -56,7 +56,11 @@ CONTAINS
     IF (lstart) THEN
       PRINT *, 'Start: ', TRIM(start)
       s => newDateTime(start)
-      CALL datetimeToString(s, dstring)
+      IF (ASSOCIATED(s)) THEN
+        CALL datetimeToString(s, dstring)
+      ELSE
+        dstring = "<null>"
+      END IF
       PRINT *, 'Start rev: ', TRIM(dstring)
       CALL deallocateDateTime(s)
     END IF