Value / Declaration question

hi everyone!

so here is my code to get Elevation :

     

    	if (!PSM && (Toybox has :SensorHistory) && (Toybox.SensorHistory has :getElevationHistory)) {
         	if (SensHist.getElevationHistory({})!=null){
         		var data = SensHist.getElevationHistory({}).next().data;
         		if(Sys.getDeviceSettings().elevationUnits==Sys.UNIT_STATUTE){data=data*3.28;}
         		dc.drawText(5, y, CFVS, data.toNumber(), TJL);
        	}
    	}


it works perfectly on mine but I don't understand it does not work on some device like MARQ.

Do I have to test whether data is null too?

100