Doubts about the LIDAR sensor

Hey!! I’m having some doubts involving the LIDAR.
According to functions
“def getMinRange(self):” and “def getMaxRange(self):” the s LIDAR is supposed to measure from 1 cm till 100 cm, otherwise returning “inf” but it still gets wrong and higher measurings, in seemingly random places. Besides that, there is some way I can filter “inf” values when analyzing the List it returns?
Couldn’t do it with.
" if lastLidar[n] != ‘inf’ and lastLidar[n+1] != ‘inf’: "
Thanks for the help!!
The functions I said were listed at
https://cyberbotics.com/doc/reference/lidar?tab-language=python