Better error handling on passing invalid packs

This commit is contained in:
Damien Guard
2017-09-08 16:10:09 -07:00
parent dab150ad6c
commit a21480f441
2 changed files with 6 additions and 1 deletions

View File

@@ -755,6 +755,10 @@ module.exports = class PackageManager {
// Deactivate the package with the given name
async deactivatePackage (name, suppressSerialization) {
const pack = this.getLoadedPackage(name)
if (pack == null) {
return
}
if (!suppressSerialization && this.isPackageActive(pack.name)) {
this.serializePackage(pack)
}

View File

@@ -285,7 +285,8 @@ class ThemeManager
deactivateThemes: ->
@removeActiveThemeClasses()
@unwatchUserStylesheet()
Promise.all(@packageManager.deactivatePackage(pack.name) for pack in @getActiveThemes())
results = @getActiveThemes().map((pack) => @packageManager.deactivatePackage(pack.name))
Promise.all(results.filter((r) => typeof r?.then is 'function'))
isInitialLoadComplete: -> @initialLoadComplete