diff --git a/uv_texture_atlas.py b/uv_texture_atlas.py
index a3744a6d851a2923cac21c3f7e731b0919b65bfb..f82c378de809567e35f82055f00e25e4eb15c95d 100644
--- a/uv_texture_atlas.py
+++ b/uv_texture_atlas.py
@@ -616,7 +616,7 @@ class MergeObjects(Operator):
             item.name = object.name
 
             # Add material to a tempObject if there are no materialSlots on the object
-            if len(activeNowObject.material_slots) == 0:
+            if len(activeNowObject.data.materials) == 0:
                 matName = "zz_TextureAtlas_NO_Material"
                 mat = bpy.data.materials.get(matName)