Skip to content

Commit 937727e

Browse files
committed
Don't throw exception when no token is found
1 parent 3276422 commit 937727e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Connection/ImapParser.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,14 @@ public function __construct(ImapTokenizer $tokenizer)
4545
*/
4646
public function next(): Data|Token|Response|null
4747
{
48-
// Load the first token.
48+
// Attempt to load the first token.
4949
if (! $this->currentToken) {
5050
$this->advance();
5151
}
5252

53+
// No token was found, return null.
5354
if (! $this->currentToken) {
54-
throw new ImapParserException('Empty response');
55+
return null;
5556
}
5657

5758
// If the token indicates the beginning of a list, parse it.

0 commit comments

Comments
 (0)