diff --git a/trac/mimeview/pygments.py b/trac/mimeview/pygments.py index c3fa038346..7e9cabf87d 100644 --- a/trac/mimeview/pygments.py +++ b/trac/mimeview/pygments.py @@ -174,7 +174,9 @@ def style_defs(style): if default_style not in styles: default_style = 'trac' selection = req.session.get('pygments_style') - if selection not in styles: + if not selection: + selection = '' + elif selection not in styles: selection = default_style output = self._generate('html', self.EXAMPLE) add_script_data(req, default_style=default_style, selection=selection)