diff --git a/src/State/Files.php b/src/State/Files.php
index 0d6cf25..43cd912 100644
--- a/src/State/Files.php
+++ b/src/State/Files.php
@@ -150,14 +150,16 @@ class Files extends State implements StateInterface {
     $cache_level = $this->config->get('cache_level');
     $cache_time = advagg_get_cache_time($cache_level);
 
-    foreach ($keys as $key) {
-      // Check if we have a value in the cache.
-      if (isset($this->cache[$key])) {
-        $values[$key] = $this->cache[$key];
-      }
-      // Load the value if we don't have an explicit NULL value.
-      elseif (!array_key_exists($key, $this->cache)) {
-        $load[] = $key;
+    if (isset($this->cache)) {
+      foreach ($keys as $key) {
+        // Check if we have a value in the cache.
+        if (isset($this->cache[$key])) {
+          $values[$key] = $this->cache[$key];
+        }
+        // Load the value if we don't have an explicit NULL value.
+        elseif (!array_key_exists($key, $this->cache)) {
+          $load[] = $key;
+        }
       }
     }
 
