How to get uv info when face.material == nil?

I usually get uvs of a model with the code below:

if faceEnt.material != nil && faceEnt.material.texture != nil # faceEnt is a Face
      uvsFront = getUVs(true, faceEnt)     
end

def getUVs(front, faceEnt)
  verts = faceEnt.outer_loop.vertices
  points = verts.collect {|v| v.position}
  uvh = faceEnt.get_UVHelper(true,true,tw)
  if front
    uvs = points.collect {|p| uvh.get_front_UVQ(p)}
  elsif
    uvs = points.collect {|p| uvh.get_back_UVQ(p)}
  end

  for i in (0..uvs.length-1)
    uvs[i] = uvs[i].to_a  #converts the Point 3D objects to arrays so they won't be transformed
    uv_w = uvs[i].z
    uvs[i].x = uvs[i].x / uv_w
    uvs[i].y = uvs[i].y / uv_w
    uvs[i].z = uvs[i].z / uv_w
  end
  return uvs
end

But the model sofa.skp (3.1 MB) does not work for it. The faces in the model have no material at all (faceEnt.material == nil). The material is on the component instance. How can I get the uv of faces if exists?

Searched and found the discussion https://forums.sketchup.com/t/uv-map-default-material/43879. No API to get UV if default material?

FYI

The linked topic has been closed, but you can ask one of the Admins to unlock it so as to add your comments.

Also the official API issue tracker has quite a few open issues having to do with UVs:

I’m not sure if this request (specific to "nil" materials) has an public open issue in the tracker. (Seems like it should. Very likely an internal Jira issue should exist as this is often discussed.)

If you cannot find one (in the filtered list) please open a GitHub issue so comments, snippets and test files can be submitted. Thanks!