pusher / atom-pair

An Atom package that allows for epic pair programming
MIT License
1.45k stars 28 forks source link

Uncaught TypeError: Cannot read property 'getText' of null #58

Closed ryanaltvater closed 7 years ago

ryanaltvater commented 9 years ago

[Enter steps to reproduce below:]

  1. ...
  2. ...

Atom Version: 1.0.3 System: Mac OS X 10.10.4 Thrown From: atom-pair package, v2.0.1

Stack Trace

Uncaught TypeError: Cannot read property 'getText' of null

At /Users/raltvater/.atom/packages/atom-pair/lib/modules/share_pane.coffee:164

TypeError: Cannot read property 'getText' of null
  at SharePane.module.exports.SharePane.shareFile (/Users/raltvater/.atom/packages/atom-pair/lib/modules/share_pane.coffee:164:26)
  at /Users/raltvater/.atom/packages/atom-pair/lib/atom_pair.coffee:179:17
  at PresenceChannel.prototype.emit (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)
  at PresenceChannel.prototype.handleEvent (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:3713:6)
  at PresenceChannel.prototype.handleEvent (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:3831:51)
  at /Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:74:9
  at ConnectionManager.prototype.emit (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)
  at message (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:3420:6)
  at Connection.prototype.emit (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)
  at listeners.message (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:3048:8)
  at TransportConnection.prototype.emit (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)
  at TransportConnection.prototype.onMessage (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:2210:6)
  at WebSocket.self.socket.onmessage (/Users/raltvater/.atom/packages/atom-pair/lib/pusher/pusher.js:2232:6)

Commands

     -3:59.5.0 AtomPair:start new pairing session (atom-text-editor#AtomPair.editor.is-focused)

Installed Packages

# User
atom-pair, v2.0.1
atom-spotify2, v2.1.2
auto-update-packages, v1.0.0
autoclose-html, v0.18.0
autocomplete-paths, v1.0.2
editorconfig, v1.0.1
emmet, v2.3.12
highlight-line, v0.11.0
linter, v1.3.0
pigments, v0.9.3
project-ring, v0.33.2
seti-syntax, v0.4.0
seti-ui, v0.7.1
sync-settings, v0.6.0
tree-view-git-status, v0.1.2
wordpress-api, v1.2.1

# Dev
No dev packages
jpatel531 commented 9 years ago

What was the setup when this issue occurred? This error can only mean the TextBuffer was null - but the package ensure an active TextEditors before creating a SharePane.

So a buffer must have been destroyed within a text editor. Though I'm not too sure how that could happen - especially without removing that sharepane from the pairing session.

Did you happen to have a split window? This issue might take longer to diagnose

jpatel531 commented 9 years ago

I suspect this is related to #52

ryanaltvater commented 9 years ago

I didn't have a split view, no. I received this error twice, and I actually wasn't looking at Atom when it occurred. I was in Chrome and when I went back to Atom, the error notification was there. That same thing happened twice. Sorry for the lack of specific details. =\

therealklanni commented 9 years ago

Just ran into this as well. My buddy joined my session and he got about half of my open tabs synced to his Atom, only the last one synced had any content (note it wasn't the last tab, just the last one that synced over to his session), all tabs were titled "untitled" in buddy's Atom, all but the last-synced were empty buffers. I believe the error appeared on my end when buddy closed the empty buffers/tabs.

Incidentally, I just happened to have the Pusher debug console open, because I was trying it out and was curious. So if there's some data I can try to pull from the debug that you think might be useful, let me know, I'll keep that tab open.

jpatel531 commented 9 years ago

Thanks for the information! This is super helpful - I'll try recreating it later on and push a fix as soon as I can

jpatel531 commented 9 years ago

Hi there, I've just published 2.0.5 which should address syncing already-open files. The question of why a buffer should a null isn't completely solved yet - but let me know how this addresses the issues :)

therealklanni commented 9 years ago

Just tried it again and got this error as soon as I joined. (2.0.5)

TypeError: undefined is not a function
    at Function.module.exports.Range.fromText (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/range.js:49:20)
    at TextBuffer.module.exports.TextBuffer.setTextInRange (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:539:24)
    at /opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:524:26
    at TextBuffer.module.exports.TextBuffer.transact (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:755:18)
    at TextBuffer.module.exports.TextBuffer.setTextInRange (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:522:21)
    at TextBuffer.module.exports.TextBuffer.setText (/opt/homebrew-cask/Caskroom/atom/latest/Atom.app/Contents/Resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:459:19)
    at /Users/klanni/.atom/packages/atom-pair/lib/modules/share_pane.coffee:75:33
    at SharePane.module.exports.SharePane.withoutTrigger (/Users/klanni/.atom/packages/atom-pair/lib/modules/share_pane.coffee:131:7)
    at /Users/klanni/.atom/packages/atom-pair/lib/modules/share_pane.coffee:74:24
    at PresenceChannel.prototype.emit (/Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)
    at PresenceChannel.prototype.handleEvent (/Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:3713:6)
    at PresenceChannel.prototype.handleEvent (/Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:3831:51)
    at /Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:74:9
    at ConnectionManager.prototype.emit (/Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)
    at message (/Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:3420:6)
    at Connection.prototype.emit (/Users/klanni/.atom/packages/atom-pair/lib/pusher/pusher.js:855:17)