Ticket #10733: 0001_1-BOptionPopUp-check-for-non-NULL-Message.2.patch

File 0001_1-BOptionPopUp-check-for-non-NULL-Message.2.patch, 1.4 KB (added by ttcoder, 11 years ago)

Version 1 (most inclusive, tries hard to return all items as options)

  • src/kits/interface/OptionControl.cpp

    From ba5606beec10bc6a35f6fa05736ea596f88e08e1 Mon Sep 17 00:00:00 2001
    From: Cedric Degea <invalid@invalid.com>
    Date: Wed, 9 Apr 2014 23:25:57 +0200
    Subject: [PATCH] BOptionPopUp: check for non-NULL Message(). Fixes #10733
    
    ---
     src/kits/interface/OptionControl.cpp |    2 +-
     src/kits/interface/OptionPopUp.cpp   |    2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/kits/interface/OptionControl.cpp b/src/kits/interface/OptionControl.cpp
    index f7e4fa8..add6d36 100644
    a b BOptionControl::SelectOptionFor(int32 value)  
    101101    int32 numOptions = CountOptions();
    102102    for (int32 c = 0; c < numOptions; c++) {
    103103        const char *name = NULL;
    104         int32 optionValue;
     104        int32 optionValue = 0;
    105105        if (GetOptionAt(c, &name, &optionValue) && optionValue == value) {
    106106            SetValue(optionValue);
    107107            return B_OK;
  • src/kits/interface/OptionPopUp.cpp

    diff --git a/src/kits/interface/OptionPopUp.cpp b/src/kits/interface/OptionPopUp.cpp
    index 666c32c..c31650c 100644
    a b BOptionPopUp::GetOptionAt(int32 index, const char** outName, int32* outValue)  
    107107        if (item != NULL) {
    108108            if (outName != NULL)
    109109                *outName = item->Label();
    110             if (outValue != NULL)
     110            if (outValue != NULL && item->Message() != NULL)
    111111                item->Message()->FindInt32("be:value", outValue);
    112112
    113113            result = true;