Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Fixes the exception thrown when the provider list for a given language is undefined. #10068

Merged
merged 3 commits into from
Dec 3, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/language/CodeInspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ define(function (require, exports, module) {
* @return ?{Array.<{name:string, scanFileAsync:?function(string, string):!{$.Promise}, scanFile:?function(string, string):?{errors:!Array, aborted:boolean}}>} provider
*/
function getProvidersForPath(filePath) {
return _providers[LanguageManager.getLanguageForPath(filePath).getId()].slice(0) || [];
return (_providers[LanguageManager.getLanguageForPath(filePath).getId()] || []).slice(0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you actually split this into two steps? Something like

var providers = _providers[LanguagerManager...];
return (providers && providers.slice(0)) || [];

It's not easily readable...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

}

/**
Expand Down