AP_OSD: check for airspeed object

This commit is contained in:
vierfuffzig 2018-09-12 10:39:25 +00:00 committed by Andrew Tridgell
parent 5a262a7f6a
commit 64915c69b6

View File

@ -973,6 +973,9 @@ void AP_OSD_Screen::draw_bat2used(uint8_t x, uint8_t y)
void AP_OSD_Screen::draw_aspd2(uint8_t x, uint8_t y) void AP_OSD_Screen::draw_aspd2(uint8_t x, uint8_t y)
{ {
AP_Airspeed *airspeed = AP_Airspeed::get_singleton(); AP_Airspeed *airspeed = AP_Airspeed::get_singleton();
if (!airspeed) {
return;
}
float asp2 = airspeed->get_airspeed(1); float asp2 = airspeed->get_airspeed(1);
if (airspeed != nullptr && airspeed->healthy(1)) { if (airspeed != nullptr && airspeed->healthy(1)) {
backend->write(x, y, false, "%c%4d%c", SYM_ASPD, (int)u_scale(SPEED, asp2), u_icon(SPEED)); backend->write(x, y, false, "%c%4d%c", SYM_ASPD, (int)u_scale(SPEED, asp2), u_icon(SPEED));