category_generator: Don't raise error viewing categories during preview

rake preview gave me the following exception:

Liquid Exception: undefined method `sort!' for nil:NilClass in post
/Users/chelmertz/Sites/octopress/plugins/category_generator.rb:159:in `category_links'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/context.rb:58:in `invoke'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/variable.rb:43:in `block in render'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `each'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `inject'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/variable.rb:38:in `render'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/block.rb:94:in `block in render_all'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `collect'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/block.rb:92:in `render_all'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/tags/if.rb:39:in `block (2 levels) in render'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/tags/if.rb:37:in `each'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/tags/if.rb:37:in `block in render'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/context.rb:91:in `stack'
/Users/chelmertz/.rvm/gems/ruby-1.9.2-p320/gems/liquid-2.3.0/lib/liquid/tags/if.rb:36:in `render'
[...]

Full trace:
https://gist.github.com/chelmertz/9bdae20e70a2400a91d3

Not sure if the change should be intercepted here or
earlier but the patch avoids throwing the exception.
The server lives on to serve more requests.