Don't crash in wxTextFile::GetLastLine() if the file is empty
Just return a reference to an empty wxString, as GetFirstLine() already does (although this is actually questionable -- what if this string is modified?). See #17283.
This commit is contained in:
@@ -125,7 +125,7 @@ public:
|
||||
wxString& GetPrevLine() /* const */
|
||||
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
||||
wxString& GetLastLine() /* const */
|
||||
{ m_nCurLine = m_aLines.size() - 1; return m_aLines.Last(); }
|
||||
{ return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = m_aLines.size() - 1]; }
|
||||
|
||||
// get the type of the line (see also GetEOL)
|
||||
wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
|
||||
|
Reference in New Issue
Block a user