Skip to content

Commit e15352b

Browse files
author
Shanee
committed
fix(abstracttextrecord): word_count function was failing not gracefully on index without nodes
1 parent 10832bb commit e15352b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sefaria/model/text.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,11 @@ class AbstractTextRecord(object):
10291029

10301030
def word_count(self):
10311031
""" Returns the number of words in this text """
1032-
return self.ja(remove_html=True).word_count()
1032+
try:
1033+
wc = self.ja(remove_html=True).word_count()
1034+
except AttributeError:
1035+
wc = 0
1036+
return wc
10331037

10341038
def char_count(self):
10351039
""" Returns the number of characters in this text """

0 commit comments

Comments
 (0)