Phase unwrapping in regions of abnormal fringes remains an unresolved issue. In this paper, we present an approach that combines an image-inpainting strategy based on an adaptive window which is obtained according to the density and orientation of fringe patterns and a quality-guided algorithm for phase unwrapping. First, a threshold is set to a quality map to detect the target region. Second, the target region is filled with new phase values by the adaptive image-inpainting method. Then, a quality-guided phase unwrapping algorithm is applied to this newly generated wrapped phase map. Finally, postprocessing of the unwrapped result is performed. The method is validated through several simulation and experiments. The results demonstrate that the proposed algorithm is effective in the presence of abnormal fringes.