obs/gs/helper: Throw exception if we aren't in a context

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-07-27 02:17:55 +02:00 committed by Michael Fabian Dirks
parent b2dd816ff2
commit b57c7975e3

View file

@ -28,6 +28,8 @@ namespace gs {
inline context()
{
obs_enter_graphics();
if (gs_get_context() == nullptr)
throw std::runtime_error("Failed to enter graphics context.");
}
~context()
{