AP_OSD: don't panic on bad font num in SITL

This commit is contained in:
Andrew Tridgell 2018-07-10 07:21:20 +10:00
parent af6c5ebda1
commit 6eb00b92fd
1 changed files with 5 additions and 0 deletions

View File

@ -46,6 +46,11 @@ void AP_OSD_SITL::load_font(void)
last_font = get_font_num();
fontname[4] = last_font + '0';
uint8_t *font_data = AP_ROMFS::find_decompress(fontname, font_size);
if (font_data == nullptr && last_font != 0) {
last_font = 0;
fontname[4] = last_font + '0';
font_data = AP_ROMFS::find_decompress(fontname, font_size);
}
if (font_data == nullptr || font_size != 54 * 256) {
AP_HAL::panic("Bad font file");
}