problem with FStaticMaterial

Hi, I’m newbie here. So, what could be the proper replacement for the DEPRECATED UStaticMesh::Materials function of UE v4.12 to use in UE v4.17.code below.

Code in UE v4.12 (using TArray UStaticMesh::Materials) working fine as below:

	for(auto cur: meshObject->Materials)
	{
		auto mat = cur->GetMaterial();

but

Code in UE v4.17 (using TArray UStaticMesh::StaticMaterials) having problem:

          for (auto cur : meshObject->StaticMaterials)
           {
		auto mat = cur->GetMaterial();

The code in UE v4.17 produces error.

Anyone kindly help me with this. Thank you.