diff --git a/src/Support/Str.php b/src/Support/Str.php index 9000a12b..a96d4a5e 100644 --- a/src/Support/Str.php +++ b/src/Support/Str.php @@ -450,6 +450,10 @@ public static function words(string $words, int $len): string $sentence = ''; for ($i = 0; $i < $len; $i++) { + if (!isset($wordParts[$i])) { + break; + } + $sentence .= ' ' . $wordParts[$i]; }