QTranslator: avoid unhandled exception
Add std::nothrow param to avoid exception and to check pointer against nullptr. Change-Id: I505abb1ca15b8c10a80b0cd3784a6b0c4c6bcc1c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
50f3f8f6bb
commit
c0b265662e
@ -72,6 +72,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <new>
|
||||||
|
|
||||||
#include "qobject_p.h"
|
#include "qobject_p.h"
|
||||||
|
|
||||||
@ -592,7 +593,7 @@ bool QTranslatorPrivate::do_load(const QString &realname, const QString &directo
|
|||||||
#endif // QT_USE_MMAP
|
#endif // QT_USE_MMAP
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
d->unmapPointer = new char[d->unmapLength];
|
d->unmapPointer = new (std::nothrow) char[d->unmapLength];
|
||||||
if (d->unmapPointer) {
|
if (d->unmapPointer) {
|
||||||
file.seek(0);
|
file.seek(0);
|
||||||
qint64 readResult = file.read(d->unmapPointer, d->unmapLength);
|
qint64 readResult = file.read(d->unmapPointer, d->unmapLength);
|
||||||
|
Loading…
Reference in New Issue
Block a user