r20868 by craig -

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 1 22:11:09 UTC 2016


Author: craig
Date: Mon Feb  1 22:11:09 2016
New Revision: 20868

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20868
Log:
coverity: #1350185,6,7 Explicit null dereferenced x2, fix unchecked dynamic_cast

Modified:
    trunk/Scribus/scribus/undostack.cpp

Modified: trunk/Scribus/scribus/undostack.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20868&path=/trunk/Scribus/scribus/undostack.cpp
==============================================================================
--- trunk/Scribus/scribus/undostack.cpp	(original)
+++ trunk/Scribus/scribus/undostack.cpp	Mon Feb  1 22:11:09 2016
@@ -75,11 +75,12 @@
 				}
 			}
 		}
-
-		m_redoActions_.insert(m_redoActions_.begin(), tmpUndoState); // push to the redo actions
-		tmpUndoState->undo();
-	}
-
+		if (tmpUndoState)
+		{
+			m_redoActions_.insert(m_redoActions_.begin(), tmpUndoState); // push to the redo actions
+			tmpUndoState->undo();
+		}
+	}
 	return true;
 }
 
@@ -107,7 +108,7 @@
 				else if((*it)->isTransaction())
 				{
 					TransactionState *ts = dynamic_cast<TransactionState*>(*it);
-					if(ts->containsOnly(objectId))
+					if(ts && ts->containsOnly(objectId))
 					{
 						tmpRedoState = *it;
 						m_redoActions_.erase(it);
@@ -116,11 +117,12 @@
 				}
 			}
 		}
-		
-		m_undoActions_.insert(m_undoActions_.begin(), tmpRedoState); // push to the undo actions
-		tmpRedoState->redo();
-	}
-	
+		if (tmpRedoState)
+		{
+			m_undoActions_.insert(m_undoActions_.begin(), tmpRedoState); // push to the undo actions
+			tmpRedoState->redo();
+		}
+	}
 	return true;
 }
 




More information about the scribus-commit mailing list