Update layout.cpp

Fix for issue #23863.

Use the measure's own method that finds out if there is a previous measure to determine whether this is the first measure.