Skip to content

Commit f0d616b

Browse files
committed
Check default objects before get_default() returns
1 parent 043a3fd commit f0d616b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

primitiv/_device.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ cdef class Device:
3737
:rtype: primitiv.Device
3838
3939
"""
40+
if py_primitiv_default_device is None:
41+
raise RuntimeError("Default object is null.")
4042
return py_primitiv_default_device
4143

4244
def dump_description(self):

primitiv/_graph.pyx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ cdef class Graph:
295295
:rtype: primitiv.Graph
296296
297297
"""
298+
if py_primitiv_default_graph is None:
299+
raise RuntimeError("Default object is null.")
298300
return py_primitiv_default_graph
299301

300302
def clear(self):

0 commit comments

Comments
 (0)