It is easy to forget that a first or second ending can be more than one measure long. One can in fact make the endings two measures (or more) long to accommodate ties as shown.
(I will note, however, that I am here transcribing from sheet music created with another product that does seem to allow one to tie across endings and thereby saving the insertion of repetitive measures. Perhaps this should still be a feature to avoid this confusion and optimize scores if nothing else.)
Perchance Music & Digital Media