Commit 643fbeee authored by Patrick José Pereira's avatar Patrick José Pereira 🏃

main: Check if object is valid before accessing it

Signed-off-by: Patrick José Pereira's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent c6d8a814
......@@ -183,7 +183,8 @@ Kirigami.ApplicationWindow {
return 0.0;
}
if (!currentVehicle.gpsPosition.isValid) {
// If currentVehicle is null or there is no valid position, set distance to zero
if (!currentVehicle || !currentVehicle.gpsPosition.isValid) {
return 0.0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment