code: private void postProcessTasks()
     {
        List<Task> allTasks = m_file.getTasks();
        if (allTasks.size() > 1)
        {
           Collections.sort(allTasks);
  
           int taskID = -1;
           int lastTaskID = -1;
  
           for (int i = 0; i < allTasks.size(); i++)
           {
              Task task = allTasks.get(i);
              taskID = NumberHelper.getInt(task.getID());
              // In Project the tasks IDs are always contiguous so we can spot invalid tasks by making sure all
              // IDs are represented.
              if (!task.getNull() && lastTaskID != -1 && taskID > lastTaskID + 1)
              {
                 // This task looks to be invalid.
                 task.setNull(true);
              }
              else
              {
                 lastTaskID = taskID;
              }
           }
        }
     }
docs: This method is called to try to catch any invalid tasks that may have sneaked past all our other checks.
  This is done by validating the tasks by task ID.