Ticket #9891: 0014-Fix-called-C-object-pointer-is-null.patch

File 0014-Fix-called-C-object-pointer-is-null.patch, 2.4 KB (added by mt, 11 years ago)

Patch

  • src/kits/storage/disk_device/jobs/SetStringJob.cpp

    From e2c4430d891300abcbd66ef17ac1f9ca2b6fc292 Mon Sep 17 00:00:00 2001
    From: Murai Takashi <tmurai01@gmail.com>
    Date: Tue, 23 Jul 2013 19:56:05 +0900
    Subject: [PATCH] Fix called C++ object pointer is null
    
    ---
     src/kits/storage/disk_device/jobs/SetStringJob.cpp |   37 +++++++++++++-------
     1 file changed, 25 insertions(+), 12 deletions(-)
    
    diff --git a/src/kits/storage/disk_device/jobs/SetStringJob.cpp b/src/kits/storage/disk_device/jobs/SetStringJob.cpp
    index 77d82c3..ef17001 100644
    a b SetStringJob::Do()  
    6262
    6363    switch (fJobType) {
    6464        case B_DISK_DEVICE_JOB_SET_NAME:
    65             error = _kern_set_partition_name(fPartition->PartitionID(),
    66                 &changeCounter, fChild->PartitionID(), &childChangeCounter,
    67                 fString);
    68             updateChildChangeCounter = true;
     65            if(fChild == NULL) {
     66                return B_BAD_VALUE;
     67            } else {
     68                error = _kern_set_partition_name(fPartition->PartitionID(),
     69                    &changeCounter, fChild->PartitionID(), &childChangeCounter,
     70                    fString);
     71                updateChildChangeCounter = true;
     72            }
    6973            break;
    7074        case B_DISK_DEVICE_JOB_SET_CONTENT_NAME:
    7175            error = _kern_set_partition_content_name(fPartition->PartitionID(),
    7276                &changeCounter, fString);
    7377            break;
    7478        case B_DISK_DEVICE_JOB_SET_TYPE:
    75             error = _kern_set_partition_type(fPartition->PartitionID(),
    76                 &changeCounter, fChild->PartitionID(), &childChangeCounter,
    77                 fString);
    78             updateChildChangeCounter = true;
     79            if(fChild == NULL) {
     80                return B_BAD_VALUE;
     81            } else {
     82                error = _kern_set_partition_type(fPartition->PartitionID(),
     83                    &changeCounter, fChild->PartitionID(), &childChangeCounter,
     84                    fString);
     85                updateChildChangeCounter = true;
     86            }
    7987            break;
    8088        case B_DISK_DEVICE_JOB_SET_PARAMETERS:
    81             error = _kern_set_partition_parameters(fPartition->PartitionID(),
    82                 &changeCounter, fChild->PartitionID(), &childChangeCounter,
    83                 fString);
    84             updateChildChangeCounter = true;
     89            if(fChild == NULL) {
     90                return B_BAD_VALUE;
     91            } else {
     92                error = _kern_set_partition_parameters(
     93                    fPartition->PartitionID(), &changeCounter,
     94                    fChild->PartitionID(), &childChangeCounter,
     95                    fString);
     96                updateChildChangeCounter = true;
     97            }
    8598            break;
    8699        case B_DISK_DEVICE_JOB_SET_CONTENT_PARAMETERS:
    87100            error = _kern_set_partition_content_parameters(