From 2fc2609488764102ce43194e9288b7bd8e25f17f Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sun, 16 May 2021 03:00:44 +0000
Subject: CTAN sync 202105160300

---
 graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

(limited to 'graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex')

diff --git a/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex b/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex
index 6d1ec5b6ab..859d8266a9 100644
--- a/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex
+++ b/graphics/pgf/base/tex/pgfmathfunctions.misc.code.tex
@@ -272,17 +272,21 @@
 \pgfmathdeclarefunction{dim}{1}{%
   \begingroup
     \pgfmath@count=0\relax
-    \expandafter\pgfmath@dim@i\pgfutil@firstofone#1\pgfmath@token@stop
+    \expandafter\pgfmath@dim@i\pgfutil@firstofone#1{\pgfmath@token@stop}%
     \edef\pgfmathresult{\the\pgfmath@count}%
     \pgfmath@smuggleone\pgfmathresult%
   \endgroup}
 
-\def\pgfmath@dim@i#1{%
-    \ifx\pgfmath@token@stop#1%
-    \else
-      \advance\pgfmath@count by 1\relax
-      \expandafter\pgfmath@dim@i
-    \fi}
+\def\pgfmath@dim@i#1#{%
+  \pgfutil@ifempty{#1}{}{\advance\pgfmath@count by 1}%
+  \pgfmath@dim@ii{#1}}
+
+\def\pgfmath@dim@ii#1#2{%
+  \ifx\pgfmath@token@stop#2%
+  \else
+    \advance\pgfmath@count by 1\relax
+    \expandafter\pgfmath@dim@i
+  \fi}
 
 
 % max function.
-- 
cgit v1.2.3

