From ff76aab72a9ced1132a5e1cc66c22c1608403e9d Mon Sep 17 00:00:00 2001
From: Brecht Van Lommel <brechtvanlommel@pandora.be>
Date: Thu, 16 May 2013 10:25:22 +0000
Subject: [PATCH] Fix #35360: F2 addon not working in some cases on a mesh with
 no faces.

---
 mesh_f2.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mesh_f2.py b/mesh_f2.py
index 5f5f78b5d..3e6f05375 100644
--- a/mesh_f2.py
+++ b/mesh_f2.py
@@ -249,9 +249,10 @@ class MeshF2(bpy.types.Operator):
         bm = bmesh.from_edit_mesh(context.active_object.data)
         sel = [v for v in bm.verts if v.select]
         if len(sel) > 2:
-            if len([True for f in bm.faces if f.select]) == len(bm.faces):
-                # all faces selected, can't create new one
-                return {'CANCELLED'}
+            if len(bm.faces) > 0:
+                if len([True for f in bm.faces if f.select]) == len(bm.faces):
+                    # all faces selected, can't create new one
+                    return {'CANCELLED'}
             # original 'Make Edge/Face' behaviour
             try:
                 bpy.ops.mesh.edge_face_add('INVOKE_DEFAULT')
@@ -301,4 +302,4 @@ def unregister():
 
 
 if __name__ == "__main__":
-    register()
\ No newline at end of file
+    register()
-- 
GitLab