fix: undefined check had incorrect return value

Small fix for your PubSub implementation.