Fix to prevent logging 'undefined' if no stack is present