Check module queue existence when logging #1086
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The current code makes a null check for the module queue before reading its length, but before it does that, it tries to access the length in another line of code. We should consistently make null checks in both places if we expect it's possible the queue could be null. This issue was masked in v6 and earlier, because the first access of
length
was inside a try-catch block. Upgrading to v7/v8 would causes some test suites to fail out when the module queue comes back as null. While this may indicate an issue, it's clear that the intent of the existing null check was to allow ember-exam to keep operating and not throw if the queue is null. It wouldn't make sense to instead throw for a line of code that's only used for the sake of logging, if we're protecting other parts of the code.