Closed ktaki closed 8 years ago
I can't reproduce, but looking at allocateDocument
I'm not surprised that something could go awry here: we call _getSelectedDocumentID
to allocate the "current" document, regardless of whether that relates to the document ID passed in (which is a little weird?), but conceivably a new document could become active after that as a result of multiple documents having been opened at once. CC @mcilroyc
Ultimately this seems like a battle with Photoshop that we can't win unless its API changes to accommodate our use case. If multiple documents are going to be opened at once, we'll need much more structured information than just a series events indicating that a file was opened.
With that said, I don't know exactly what is causing that particular error, and that would be good to track down in case either a) my guess above about what's wrong is incorrect, or b) it's correct, but we can recover more gracefully. CC @shaoshing also since he may be considering our document initialization routines as part of his performance optimization work.
My initial hunch is that a reasonable fix may just be to add some defensive code in the menu update routine. I'm still trying to repro. Perhaps I need to try on a slower machine...
If two Vermillion documents do not produce the error, try with three or four duplicates.
FYI, can repro on Windows VM
FBNC to @ktaki.
Verified the fix.
Uncaught TypeError: Cannot read property 'id' of null
Method: