diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 3c721643c642c85a7df009ee1310f3319ecb69f1..b043ec6deebe6cae4dab0fb3bf1bb5227cdea4c2 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -383,6 +383,11 @@ def write_file(filepath, objects, scene, materials = me.materials[:] material_names = [m.name if m else None for m in materials] + # avoid bad index errors + if not materials: + materials = [None] + material_names = [""] + # Sort by Material, then images # so we dont over context switch in the obj file. if EXPORT_KEEP_VERT_ORDER: