From 013fd4feaf37b5c1743ce4a438bb24c76094e2f3 Mon Sep 17 00:00:00 2001
From: Jonathan Goode <u01jmg3@users.noreply.github.com>
Date: Wed, 18 Sep 2024 17:12:39 +0100
Subject: [PATCH] Account for `preg_split()` also returning `false`

---
 src/Concerns/InteractsWithElements.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/Concerns/InteractsWithElements.php b/src/Concerns/InteractsWithElements.php
index 36ea1e78a..d99630d37 100644
--- a/src/Concerns/InteractsWithElements.php
+++ b/src/Concerns/InteractsWithElements.php
@@ -166,8 +166,12 @@ public function append($field, $value)
      */
     public function appendSlowly($field, $value, $pause = 100)
     {
-        foreach (preg_split('//u', $value, -1, PREG_SPLIT_NO_EMPTY) as $char) {
-            $this->append($field, $char)->pause($pause);
+        $characters = preg_split('//u', $value, -1, PREG_SPLIT_NO_EMPTY);
+
+        if (is_array($characters)) {
+            foreach ($characters as $character) {
+                $this->append($field, $character)->pause($pause);
+            }
         }
 
         return $this;