Merge lp:~michael-sheldon/ubuntu-keyboard/fix-1407584 into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 271
Merged at revision: 271
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-1407584
Merge into: lp:ubuntu-keyboard
Diff against target: 36 lines (+10/-9)
1 file modified
plugins/pinyin/src/pinyinadapter.cpp (+10/-9)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-1407584
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+245560@code.launchpad.net

Commit message

Check candidates provided by libpinyin are valid before using them

Description of the change

Check candidates provided by libpinyin are valid before using them (fixes crash)

To post a comment you must log in.
Revision history for this message
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-keyboard) on device or emulator?

 * Yes

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * No change

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

approved

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/pinyin/src/pinyinadapter.cpp'
2--- plugins/pinyin/src/pinyinadapter.cpp 2014-12-11 14:49:23 +0000
3+++ plugins/pinyin/src/pinyinadapter.cpp 2015-01-05 10:54:14 +0000
4@@ -64,13 +64,13 @@
5 {
6 lookup_candidate_t * candidate = NULL;
7
8- pinyin_get_candidate(m_instance, i, &candidate);
9-
10- const char* word = NULL;
11- pinyin_get_candidate_string(m_instance, candidate, &word);
12- // Translate the token to utf-8 phrase.
13- if (word) {
14- candidates.append(QString(word));
15+ if (pinyin_get_candidate(m_instance, i, &candidate)) {
16+ const char* word = NULL;
17+ pinyin_get_candidate_string(m_instance, candidate, &word);
18+ // Translate the token to utf-8 phrase.
19+ if (word) {
20+ candidates.append(QString(word));
21+ }
22 }
23 }
24
25@@ -86,8 +86,9 @@
26 Q_UNUSED(word)
27
28 lookup_candidate_t * candidate = NULL;
29- pinyin_get_candidate(m_instance, 1, &candidate);
30- pinyin_choose_candidate(m_instance, 0, candidate);
31+ if (pinyin_get_candidate(m_instance, 1, &candidate)) {
32+ pinyin_choose_candidate(m_instance, 0, candidate);
33+ }
34 }
35
36 void PinyinAdapter::reset()

Subscribers

People subscribed via source and target branches