From 507eed0412d396d6b104f387fe5e9d46347adea4 Mon Sep 17 00:00:00 2001 From: cage Date: Tue, 3 Oct 2023 21:20:09 +0200 Subject: [PATCH] - [gopher] prevented crash when opening a gopher link and gopher window is not visible; - [gopher] fixed parsing of text files. --- src/gopher-window.lisp | 3 ++- src/gopher/parser.lisp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gopher-window.lisp b/src/gopher-window.lisp index b87dab5..279cb99 100644 --- a/src/gopher-window.lisp +++ b/src/gopher-window.lisp @@ -247,7 +247,8 @@ ((gopher-parser::%line-type-index-search-p type) (search-index-server host port selector)) ((gopher-parser::%line-type-file-p type) - (win-close *gopher-window*) + (when *gopher-window* + (win-close *gopher-window*)) (let ((data (misc:make-fresh-array 0 :type '(unsigned-int 8)))) (gopher-client:request host type diff --git a/src/gopher/parser.lisp b/src/gopher/parser.lisp index aa9d756..7af065f 100644 --- a/src/gopher/parser.lisp +++ b/src/gopher/parser.lisp @@ -310,7 +310,7 @@ (defrule text-block (+ (not (and #\Newline #\. #\Return #\Newline))) (:text t)) -(defrule text-file (and (* text-block) (and #\Newline #\. #\Return #\Newline)) +(defrule text-file (and (* text-block) (? (and #\Newline #\. #\Return #\Newline))) (:function caar)) (defun parse-text-file (data)