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