Fix Undefined array key 1 error on fetching emails - closes #4195

This commit is contained in:
FreeScout
2024-08-26 22:22:06 -07:00
parent ca1a7d0900
commit 39824c876d

View File

@@ -152,7 +152,12 @@ class Structure {
foreach ($positions as $pos_i => $pos) {
if ($pos == 0) {
// First.
$ctx = substr($context, 0+2, $positions[$pos_i+1]-2);
if (isset($positions[$pos_i+1])) {
$ctx = substr($context, 0+2, $positions[$pos_i+1]-2);
} else {
// First and last.
$ctx = substr($context, 0+2);
}
} elseif ($pos_i == count($positions)-1) {
// Last.
$ctx = substr($context, $pos+$boundary_len+2);