[ruby/rdoc] fix: Fix NoMethodError for tokens_to_s method

Calling `tokens_to_s` gets an error if `token_stream` is nil:

```
undefined method `compact' for nil:NilClass (NoMethodError)
```

So, fall back to an empty array if `@token_stream` is nil.

452e4a2600
This commit is contained in:
toshimaru 2023-11-16 09:18:08 +09:00 committed by git
parent d2e7a70ee6
commit 72242e69aa
2 changed files with 10 additions and 1 deletions

View file

@ -105,7 +105,7 @@ module RDoc::TokenStream
# Current token stream
def token_stream
@token_stream
@token_stream || []
end
##