only checks if the currently processed milestone index is bigger than the old one. If it happens that a milestone becomes solid that is not immediately following the previous one, all other milestones in between get subsequently ignored and the ledger state becomes invalid.
The following line:
https://github.com/iotaledger/iri/blob/4f13ce3a3d212a0fbfbb23afc9bc5a4d8e2e9bf5/src/main/java/com/iota/iri/Milestone.java#L237
only checks if the currently processed milestone index is bigger than the old one. If it happens that a milestone becomes solid that is not immediately following the previous one, all other milestones in between get subsequently ignored and the ledger state becomes invalid.