does the following lines work if `mesh==nullptr`?