Skip to content

Check result of acos for NaN

This fixes the crash in g_date_time_to_instant as filed in #91 (closed).

Source of the crash

The value given to acos is < -1 which results in acos returning NaN which results in min-int32 values for rise_hour, rise_min, set_hour and set_min.

Workaround/Fix

Return 00:00-23:59 sunrise/sunset if acos returned NaN. As we do for other locations we are not able to calculate the sunrise/sunset for.

Reproduce

The crash can be reproduced by adding a world-clock for “Ambler, Alaska”

Edited by Johannes Wolf

Merge request reports