Same thing here. To elaborate on the bug, in my case the problem occurs when flexible content field names are duplicated.
e.g.
Flexible Content Layout #1
Name: type1
Fields: subfield1
Flexible Content Layout #2
Name: type2
Fields: subfield1, subfield2, subfield3
get_sub_field(‘subfield1’) will only work for rows of layout ‘type1’. For a row of layout ‘type2’ fields with unique names will display (‘subfield2’, ‘subfield3’), but the field with a duplicate name will return empty (‘subfield1’).
Downgrading to 5.1.0 fixed the problem.