mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-02-04 07:57:28 +08:00
35 lines
1.1 KiB
Diff
35 lines
1.1 KiB
Diff
From: Andriy Rysin <arysin@gmail.com>
|
|
Date: Sun, 03 Apr 2011 02:27:37 +0000
|
|
Subject: Fix null pointer crash when no rules found; add unit test
|
|
X-Git-Url: http://quickgit.kde.org/?p=kde-workspace.git&a=commitdiff&h=754b4aee80ef521433c8179bca122c22135f5118
|
|
---
|
|
Fix null pointer crash when no rules found; add unit test
|
|
BUG: 269961
|
|
---
|
|
|
|
|
|
--- a/kcontrol/keyboard/flags.cpp
|
|
+++ b/kcontrol/keyboard/flags.cpp
|
|
@@ -136,7 +136,7 @@ static QString getDisplayText(const QStr
|
|
{
|
|
if( variant.isEmpty() )
|
|
return layout;
|
|
- if( rules->version == "1.0" )
|
|
+ if( rules == NULL || rules->version == "1.0" )
|
|
return i18nc("layout - variant", "%1 - %2", layout, variant);
|
|
return variant;
|
|
}
|
|
|
|
--- a/kcontrol/keyboard/tests/flags_test.cpp
|
|
+++ b/kcontrol/keyboard/tests/flags_test.cpp
|
|
@@ -82,6 +82,9 @@ private Q_SLOTS:
|
|
QVERIFY( flags->getLongText(layoutUnit1, rules).startsWith("USA - International") );
|
|
QCOMPARE( flags->getLongText(layoutUnit2, rules), QString("USA - other") );
|
|
|
|
+ rules = NULL; // when no rules found
|
|
+ QCOMPARE( flags->getLongText(layoutUnit1, rules), QString("us - intl") );
|
|
+
|
|
flags->clearCache();
|
|
}
|
|
|