FIX: Color scheme stylesheet not loaded when no default theme is set.

FIX: Color scheme stylesheet not loaded when no default theme is set.

Follow-up to 8e3691d5370bb95d99fe750f46287763721fcc9c

diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rb
index 42f96e4..c433f90 100644
--- a/lib/stylesheet/manager.rb
+++ b/lib/stylesheet/manager.rb
@@ -269,23 +269,19 @@ class Stylesheet::Manager
 
     theme = get_theme(theme_id)
 
-    if theme
-      builder = Builder.new(
-        target: target,
-        theme: get_theme(theme_id),
-        color_scheme: color_scheme,
-        manager: self
-      )
-
-      builder.compile unless File.exists?(builder.stylesheet_fullpath)
-
-      href = builder.stylesheet_path(current_hostname)
-      stylesheet[:new_href] = href
-      cache.defer_set(cache_key, stylesheet.freeze)
-      stylesheet
-    else
-      {}
-    end
+    builder = Builder.new(
+      target: target,
+      theme: get_theme(theme_id),
+      color_scheme: color_scheme,
+      manager: self
+    )
+
+    builder.compile unless File.exists?(builder.stylesheet_fullpath)
+
+    href = builder.stylesheet_path(current_hostname)
+    stylesheet[:new_href] = href
+    cache.defer_set(cache_key, stylesheet.freeze)
+    stylesheet
   end
 
   def color_scheme_stylesheet_link_tag(color_scheme_id = nil, media = 'all')
diff --git a/spec/components/stylesheet/manager_spec.rb b/spec/components/stylesheet/manager_spec.rb
index 7b64c8d..7efb508 100644
--- a/spec/components/stylesheet/manager_spec.rb
+++ b/spec/components/stylesheet/manager_spec.rb
@@ -396,13 +396,14 @@ describe Stylesheet::Manager do
   describe 'color_scheme_stylesheets' do
     it "returns something by default" do
       link = manager.color_scheme_stylesheet_link_tag
-      expect(link).not_to eq("")
+      expect(link).to include("color_definitions_base")
     end
 
     it "does not crash when no default theme is set" do
       SiteSetting.default_theme_id = -1
       link = manager.color_scheme_stylesheet_link_tag
-      expect(link).not_to eq("")
+
+      expect(link).to include("color_definitions_base")
     end
 
     it "loads base scheme when defined scheme id is missing" do

GitHub sha: be655762d8ad4b9d29d62720ab5be12dcaac4cba

This commit appears in #13453 which was approved by lis2. It was merged by tgxworld.