syntax-highlighting
syntax-highlighting copied to clipboard
Fix(IndexError): Handle unexpected System level pygments import
Description
Problem
If pygments is installed via pip (In my case pygments version 2.15), it will be used regardless of the locally shipped pygments dependency.
Solution
Defensively checks bounds to ensure no index exception occurs.
Checklist:
- [x] I've read and understood the contribution guidelines
- [x] I've tested my changes against at least one of the following Anki builds:
- [x ] Latest standard Anki 2.1 binary build [required for Anki-compatible 2.1 add-ons]
- [ ] Latest alternative Anki 2.1 binary build
- [ ] Latest Anki 2.0 binary build [required for Anki 2.0-compatible add-ons]
- [x] I've tested my changes on at least one of the following platforms:
- [x] Linux, version: Arch Linux
- [x ] Windows, version: Windows 10
- [ ] macOS, version:
- [ ] My changes potentially affect non-desktop platforms, of which I've tested:
- [ ] AnkiMobile, version:
- [ ] AnkiDroid, version:
- [ ] AnkiWeb