With MAX function Oracle returns null record if there are no records matching your condition. For example

select max(dummy) from dual where dummy <>'X';

returns one row with null value. Check if similar thing is happening in your code.