macOS: Handle NSNull when file dialog directories change

For some directories, such as the 'Recents' entry in the native file
dialog, the panel:directoryDidChange: callback will report a NSNull
for the NSString path, which results in an exception when trying to
compute the length of this null entry.

Pick-to: 6.6 6.5 6.2
Change-Id: Ic9cddb54ea713b8fbdcaf0f4fb506ac96e90c9fe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 3bf7e0693ec1df01d2d27e28ab38f553beaa9c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2023-12-09 19:02:09 +01:00 committed by Qt Cherry-pick Bot
parent bbd868ff68
commit c8d2158bd2

View File

@ -379,7 +379,10 @@ typedef QSharedPointer<QFileDialogOptions> SharedPointerFileDialogOptions;
if (!m_helper)
return;
if (!(path && path.length) || [path isEqualToString:m_currentDirectory])
if (!path || [path isEqual:NSNull.null] || !path.length)
return;
if ([path isEqualToString:m_currentDirectory])
return;
[m_currentDirectory release];