]> _ Git - fluidbook-toolbox.git/commitdiff
#7569
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 27 May 2025 09:01:44 +0000 (11:01 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 27 May 2025 09:01:44 +0000 (11:01 +0200)
app/Fluidbook/Compiler/Compiler.php

index b769545b549c23e754c81a57560f8ef3110ee73d..3496714b208e6f3ebc14ea691f6637b6a18bacda 100644 (file)
@@ -1774,11 +1774,14 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
      * @param $page
      * @return array
      */
-    protected function getPageDimension($page)
+    protected function getPageDimension($page): ?array
     {
         $k = 'pagesDimensions.' . $page;
         if (!$this->config->has($k)) {
             $d = $this->getFluidbook()->getDocumentSize($page);
+            if (null === $d) {
+                return null;
+            }
             $res = [round($this->cssWidth, 2), round($d[1] * ($this->cssWidth / $d[0]), 2)];
             $this->config->set($k, $res);
             return $res;
@@ -1788,12 +1791,12 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
 
     public function getWidth($page = 1)
     {
-        return $this->getPageDimension($page)[0];
+        return $this->getPageDimension($page)[0]??null;
     }
 
     public function getHeight($page = 1)
     {
-        return $this->getPageDimension($page)[1];
+        return $this->getPageDimension($page)[1]??null;
     }