Skip to content

Commit a317b84

Browse files
committed
additional initialized checks
1 parent 8746f3c commit a317b84

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/polyscope.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ void popContext() {
260260
ImGuiContext* getCurrentContext() { return contextStack.empty() ? nullptr : contextStack.back().context; }
261261

262262
void frameTick() {
263+
checkInitialized();
263264

264265
// Do some sanity-checking around control flow and use of frameTick() / show()
265266
if (contextStack.size() > 1) {
@@ -271,8 +272,7 @@ void frameTick() {
271272
}
272273
frameTickStack++;
273274

274-
// Make sure we're initialized and visible
275-
checkInitialized();
275+
// Make sure we're visible
276276
render::engine->showWindow();
277277

278278
// All-imporant main loop iteration

src/screenshot.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ bool hasExtension(std::string str, std::string ext) {
3737

3838

3939
void saveImage(std::string name, unsigned char* buffer, int w, int h, int channels) {
40+
checkInitialized();
4041

4142
// our buffers are from openGL, so they are flipped
4243
stbi_flip_vertically_on_write(1);
@@ -64,6 +65,7 @@ void saveImage(std::string name, unsigned char* buffer, int w, int h, int channe
6465
}
6566

6667
void screenshot(std::string filename, bool transparentBG) {
68+
checkInitialized();
6769

6870
render::engine->useAltDisplayBuffer = true;
6971
if (transparentBG) render::engine->lightCopy = true; // copy directly in to buffer without blending
@@ -125,6 +127,7 @@ void resetScreenshotIndex() { state::screenshotInd = 0; }
125127

126128

127129
std::vector<unsigned char> screenshotToBuffer(bool transparentBG) {
130+
checkInitialized();
128131

129132
render::engine->useAltDisplayBuffer = true;
130133
if (transparentBG) render::engine->lightCopy = true; // copy directly in to buffer without blending

0 commit comments

Comments
 (0)