get-filename might return #f; check for that properly

This commit is contained in:
Robby Findler 2014-04-24 07:01:26 -05:00
parent 7a435b154c
commit 846342db9f

View File

@ -647,8 +647,9 @@
(let loop ([snip (send pasteboard find-first-snip)]) (let loop ([snip (send pasteboard find-first-snip)])
(when snip (when snip
(when (is-a? snip boxed-word-snip<%>) (when (is-a? snip boxed-word-snip<%>)
(define fn (send snip get-filename))
(define found? (define found?
(and reg (regexp-match reg (path->string (send snip get-filename))))) (and reg fn (regexp-match reg (path->string fn))))
(when (or (not reg) found?) (when (or (not reg) found?)
(for ([phase (in-list (send snip get-require-phases))]) (for ([phase (in-list (send snip get-require-phases))])
(set! phases (set-add phases phase))) (set! phases (set-add phases phase)))
@ -1098,28 +1099,28 @@
(is-a? snip boxed-word-snip<%>) (is-a? snip boxed-word-snip<%>)
canvas canvas
(send snip get-filename)) (send snip get-filename))
(instantiate menu-item% () (new menu-item%
(label [label
(trim-string (trim-string
(format open-file-format (format open-file-format
(path->string (send snip get-filename))) (path->string (send snip get-filename)))
200)) 200)]
(parent right-button-menu) [parent right-button-menu]
(callback [callback
(λ (x y) (λ (x y)
(handler:edit-file (handler:edit-file
(send snip get-filename)))))) (send snip get-filename)))]))
(instantiate menu-item% () (new menu-item%
(label (string-constant module-browser-open-all)) [label (string-constant module-browser-open-all)]
(parent right-button-menu) [parent right-button-menu]
(callback [callback
(λ (x y) (λ (x y)
(let loop ([snip (find-first-snip)]) (let loop ([snip (find-first-snip)])
(when snip (when snip
(when (is-a? snip boxed-word-snip<%>) (when (is-a? snip boxed-word-snip<%>)
(let ([filename (send snip get-filename)]) (let ([filename (send snip get-filename)])
(handler:edit-file filename))) (handler:edit-file filename)))
(loop (send snip next))))))) (loop (send snip next)))))])
(send canvas popup-menu (send canvas popup-menu
right-button-menu right-button-menu
(+ (send evt get-x) 1) (+ (send evt get-x) 1)