command: fix deref before NULL check

Was accidentally broken in the last global variable removal round.
core: remove dead --vsync leftovers
demux: always sort chapters

The condition that checked whether the chapters are out of order and
should be sorted was inverted. This likely wasn't noticed in testing,
because even if the chapters are unsorted, if the last two chapters
were sorted, the rest got sorted too.

Instead of doing this silly check, always sort the chapters after
demuxer initialization. Also make sure the sort order is stable in case
chapter start times are the same (original_index check).
demux: simplify chapter appending code

This pre-allocation looked tricky and awkward. Use MP_TARRAY_APPEND(),
which makes the code simpler. This even keeps the pre-allocation.