[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert
From: |
lu4nx |
Subject: |
bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error |
Date: |
Sun, 6 Mar 2016 14:48:27 +0800 |
From: Xi Lu <address@hidden>
if forget create a partition, and execute:
`name 1 grub`
ped_disk_get_partition() will trigger an exception:
Assertion (disk != NULL)
---
libparted/disk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libparted/disk.c b/libparted/disk.c
index fe82f44..9f36d10 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -1594,7 +1594,10 @@ ped_disk_get_partition (const PedDisk* disk, int num)
{
PedPartition* walk;
- PED_ASSERT (disk != NULL);
+ if (disk == NULL) {
+ fprintf(stderr, "you must specify partition.");
+ return NULL;
+ }
for (walk = disk->part_list; walk;
walk = ped_disk_next_partition (disk, walk)) {
--
2.5.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#22920: [PATCH] libparted/disk.c(ped_disk_get_partition): Fix assert error,
lu4nx <=