From 1d4fd42795331fe1cfb8e404f1784cf20f387649 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 18 Jan 2010 03:02:10 +0100 Subject: changed handling of empty list detection std::list.back() returns undefined values if list is empty --- src/base/song.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/base/song.cpp') diff --git a/src/base/song.cpp b/src/base/song.cpp index e1b39360..f596e480 100644 --- a/src/base/song.cpp +++ b/src/base/song.cpp @@ -121,10 +121,8 @@ namespace usdx LyricLine* Song::get_last_lyric_line(void) { - LyricLine* line = lyrics.back(); - - if (line) { - return line; + if (lyrics.size() > 0) { + return lyrics.back(); } return create_new_lyric_line(0); -- cgit v1.2.3