Skip to content

Commit

Permalink
Adding check for null Screen which was causing a crash in our project. (
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojb authored and wjakob committed Aug 10, 2017
1 parent f9c3951 commit d8903a4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/textbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,8 @@ bool TextBox::checkFormat(const std::string &input, const std::string &format) {
bool TextBox::copySelection() {
if (mSelectionPos > -1) {
Screen *sc = dynamic_cast<Screen *>(this->window()->parent());
if (!sc)
return false;

int begin = mCursorPos;
int end = mSelectionPos;
Expand All @@ -530,6 +532,8 @@ bool TextBox::copySelection() {

void TextBox::pasteFromClipboard() {
Screen *sc = dynamic_cast<Screen *>(this->window()->parent());
if (!sc)
return;
const char* cbstr = glfwGetClipboardString(sc->glfwWindow());
if (cbstr)
mValueTemp.insert(mCursorPos, std::string(cbstr));
Expand Down

0 comments on commit d8903a4

Please sign in to comment.