Skip to content

Commit

Permalink
Fix some potential crashes
Browse files Browse the repository at this point in the history
The email crash report feature is pretty helpful sometimes
  • Loading branch information
sirjuddington committed Sep 20, 2016
1 parent 283e988 commit 6e3a939
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/MainEditor/UI/ArchivePanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,7 @@ bool ArchivePanel::importEntry()
ok = false;
}
// Warn if the offsets couldn't be written
if (ok && !si.getFormat()->writeOffset(si, selection[a], offset))
if (ok && si.getFormat() && !si.getFormat()->writeOffset(si, selection[a], offset))
wxLogMessage("Old offset information [%d, %d] couldn't be "
"preserved in the new image format for image %s.",
offset.x, offset.y, selection[a]->getName());
Expand Down
2 changes: 1 addition & 1 deletion src/Utility/PropertyList/PropertyList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ PropertyList::~PropertyList()
bool PropertyList::propertyExists(string key)
{
// Try to find specified key
if (properties.find(key) == properties.end())
if (properties.empty() || properties.find(key) == properties.end())
return false;
else
return true;
Expand Down
6 changes: 6 additions & 0 deletions src/Utility/Tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ bool Tokenizer::incrementCurrent()
*******************************************************************/
void Tokenizer::skipLineComment()
{
if (atEnd())
return;

// Increment position until a newline or end is found
while (current[0] != '\n' && current[0] != 13)
{
Expand All @@ -295,6 +298,9 @@ void Tokenizer::skipLineComment()
*******************************************************************/
void Tokenizer::skipMultilineComment()
{
if (atEnd())
return;

// Increment position until '*/' or end is found
while (!(current[0] == '*' && current[1] == '/'))
{
Expand Down

0 comments on commit 6e3a939

Please sign in to comment.