Run time error when retrieving JSON data

The line val photoResponse: PhotoResponse? = flickrResponse?.photos

in listing 24.27 fails with an UnitializedPropertyAccessException: lateinit property photos has not being initialized.

Is something missing from the code in Chapter 24?

Have you checked your values?

The code from chapter worked fine for me.
When I stared to do the challenge (adding a custom gson deserializer) Ive received similar error, so maybe check if you copied “FlickrResponse” and “PhotoResponse” classes correctly or your “fetchPhotos()” is exactly as in a book.