Blob Blame History Raw
diff -up pyparted-3.9/src/pydisk.c.orig pyparted-3.9/src/pydisk.c
--- pyparted-3.9/src/pydisk.c.orig	2018-01-12 13:49:41.071972417 -0500
+++ pyparted-3.9/src/pydisk.c	2018-01-12 13:52:55.264256591 -0500
@@ -2003,7 +2003,11 @@ PyObject *py_ped_disk_new_fresh(PyObject
                 !PyErr_ExceptionMatches(PyExc_NotImplementedError))
                 PyErr_SetString(DiskException, partedExnMessage);
         } else {
-            PyErr_Format(DiskException, "Could not create new disk label on %s", disk->dev->path);
+            if (disk->dev == NULL) {
+                PyErr_Format(DiskException, "Could not create new disk label");
+            } else {
+                PyErr_Format(DiskException, "Could not create new disk label on %s", disk->dev->path);
+            }
         }
 
         return NULL;
@@ -2035,7 +2039,11 @@ PyObject *py_ped_disk_new(PyObject *s, P
                 !PyErr_ExceptionMatches(PyExc_NotImplementedError))
                 PyErr_SetString(DiskException, partedExnMessage);
         } else {
-            PyErr_Format(DiskException, "Could not create new disk label on %s", disk->dev->path);
+            if (disk->dev == NULL) {
+                PyErr_Format(DiskException, "Could not create new disk label");
+            } else {
+                PyErr_Format(DiskException, "Could not create new disk label on %s", disk->dev->path);
+            }
         }
 
         return NULL;
diff -up pyparted-3.9/src/pyfilesys.c.orig pyparted-3.9/src/pyfilesys.c