← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3304: fix a crash with non-bold fonts with spaces

 

------------------------------------------------------------
revno: 3304
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Sat 2013-06-01 14:55:58 +0200
message:
  fix a crash with non-bold fonts with spaces
modified:
  win32/HtmlToRtf.cpp


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'win32/HtmlToRtf.cpp'
--- win32/HtmlToRtf.cpp	2013-01-18 21:28:38 +0000
+++ win32/HtmlToRtf.cpp	2013-06-01 12:55:58 +0000
@@ -260,8 +260,7 @@
 	// remove empty strings.
 	l.erase(std::remove_if(l.begin(), l.end(), [](const string& s) { return s.empty(); }), l.end());
 
-	auto params = l.size();
-	if(params < 2) // the last 2 params (font size & font family) are compulsory.
+	if(l.size() < 2) // the last 2 params (font size & font family) are compulsory.
 		return;
 
 	// the last param (font family) may contain spaces; merge if that is the case.
@@ -288,12 +287,12 @@
 	}
 
 	// parse the optional third to last param (font weight).
-	if(params > 2 && Util::toInt(*(l.end() - 3)) >= FW_BOLD) {
+	if(l.size() > 2 && Util::toInt(*(l.end() - 3)) >= FW_BOLD) {
 		contexts.back().setFlag(Context::Bold);
 	}
 
 	// parse the optional first param (font style).
-	if(params > 2 && l[0] == "italic") {
+	if(l.size() > 2 && l[0] == "italic") {
 		contexts.back().setFlag(Context::Italic);
 	}
 }