Fix AIOOBE.
Fix NPE when pasting an empty buffer

Right-click paste is grayed out when buffer is empty, but middle button
paste is still available