Skip to content

Commit d9fd94f

Browse files
committed
fix handling of snip%s that don't have a snipclass
1 parent 860f14b commit d9fd94f

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

gui-lib/framework/private/text.rkt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,14 +2232,20 @@
22322232

22332233
(struct snip-special (snip name bytes))
22342234
(define (make-snip-special snip)
2235-
(define base (new editor-stream-out-bytes-base%))
2236-
(define stream (make-object editor-stream-out% base))
2237-
(send snip write stream)
2238-
(snip-special snip
2239-
(send (send snip get-snipclass) get-classname)
2240-
(send base get-bytes)))
2235+
(define the-snipclass (send snip get-snipclass))
2236+
(cond
2237+
[the-snipclass
2238+
(define base (new editor-stream-out-bytes-base%))
2239+
(define stream (make-object editor-stream-out% base))
2240+
(send snip write stream)
2241+
(snip-special snip
2242+
(send the-snipclass get-classname)
2243+
(send base get-bytes))]
2244+
[else
2245+
(snip-special snip #f #f)]))
22412246
(define (snip-special->snip snip-special)
2242-
(define snipclass (send (get-the-snip-class-list) find (snip-special-name snip-special)))
2247+
(define the-name (snip-special-name snip-special))
2248+
(define snipclass (and the-name (send (get-the-snip-class-list) find the-name)))
22432249
(cond
22442250
[snipclass
22452251
(define base (make-object editor-stream-in-bytes-base%

0 commit comments

Comments
 (0)