From 49c571cb3f8db0732ac9b461890af2c09722c71b Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Wed, 16 Apr 2025 19:53:26 -0400
Subject: fixed authorizing dropbox.

---
 src/client/views/smartdraw/DrawingFillHandler.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/client/views/smartdraw/DrawingFillHandler.tsx')

diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx
index a91ec23b8..b0945fd83 100644
--- a/src/client/views/smartdraw/DrawingFillHandler.tsx
+++ b/src/client/views/smartdraw/DrawingFillHandler.tsx
@@ -26,11 +26,12 @@ export class DrawingFillHandler {
         const styleUrl = tags.length
             ? undefined
             : await DocumentView.GetDocImage(styleDocs.filter(doc => doc?.data instanceof ImageField).lastElement())?.then(styleImg => {
-                  const hrefParts = ImageCast(styleImg).url.href.split('.');
-                  return `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
+                  const hrefParts = ImageCast(styleImg)?.url.href.split('.');
+                  return !hrefParts ? undefined : `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
               });
         return DocumentView.GetDocImage(drawing)?.then(imageField => {
-            if (imageField) {
+            const href = ImageCast(imageField)?.url.href;
+            if (href) {
                 const aspectRatio = (drawing.width as number) / (drawing.height as number);
                 const dims = (() => {
                     if (aspectRatio > AspectRatioLimits[FireflyImageDimensions.Widescreen]) return FireflyDimensionsMap[FireflyImageDimensions.Widescreen];
@@ -38,7 +39,6 @@ export class DrawingFillHandler {
                     if (aspectRatio < AspectRatioLimits[FireflyImageDimensions.Portrait]) return FireflyDimensionsMap[FireflyImageDimensions.Portrait];
                     return FireflyDimensionsMap[FireflyImageDimensions.Square];
                 })();
-                const { href } = ImageCast(imageField).url;
                 const hrefParts = href.split('.');
                 const structureUrl = `${hrefParts.slice(0, -1).join('.')}_o.${hrefParts.lastElement()}`;
                 return gptDescribeImage(user_prompt, structureUrl).then(newPrompt =>
-- 
cgit v1.2.3-70-g09d2

