I was able to solve it by creating it with the help of CTE (Common Table Expression), where I created a table with the ranges between stations without nulls and made a join with the main table. This returned the expected result.
Thank you guys for the advise about the null values!