commit 491e55687a1b769c8355882e1578c488b5a39ee1
parent 26bf5e68f8f4cad7a0a964b3d628c0df44e349d5
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Mon, 30 Jul 2018 21:22:50 +0000
Account for articles without a title.
This happens for e.g. some picture-only posts
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fbstream.d b/fbstream.d
@@ -241,7 +241,11 @@ struct Post{
* a lot of multibyte characters in the string.
*/
@property string title(){
- string cont=content.getChildren()[0].getCData();
+ auto children=content.getChildren();
+ if(children.length==0){
+ return "";
+ }
+ string cont=children[0].getCData();
if(cont.length>title_cutoff){
cont=cont[0..toUTFindex(cont,title_cutoff)];
cont~="...";