Revert "Remove unnecessary dialog check"

This reverts commit f6afdd4c96ce5c8c3ae48fd67a400599a83ee6c9.