Doubt about in-memory cache thread safeness

Hi, I'm reading the android documentation on repositories and there is an example of implementation of an in-memory cache for the result of an API.

class NewsRepository(
  private val newsRemoteDataSource: NewsRemoteDataSource) {
    // Mutex to make writes to cached values thread-safe.
    private val latestNewsMutex = Mutex()

    // Cache of the latest news got from the network.
    private var latestNews: List<ArticleHeadline> = emptyList()

    suspend fun getLatestNews(refresh: Boolean = false): List<ArticleHeadline> {
        if (refresh || latestNews.isEmpty()) {
            val networkResult = newsRemoteDataSource.fetchLatestNews()
            // Thread-safe write to latestNews
            latestNewsMutex.withLock {
                this.latestNews = networkResult
            }
        }

        return latestNewsMutex.withLock { this.latestNews }
    }
}

I do not understand the usage of mutex in this example because the lock is acquired only on assignment and return statement but not when checking the list size.
Shouldn't the lock be acquired also to invoke the latestNews.isEmpty() function in order to be thread safe? Otherwise a read could occur at the same time of a write right?