For fields without any energy immission, the code below is fatal:

'#markup' => round(($energy / $maximum) * 100)

Easiest solution: if $maximum is 0, then set it to 1.

Patch to follow.

CommentFileSizeAuthor
#1 division_by_zero-1610732-1.patch1.29 KBAnonymous (not verified)

Comments

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new1.29 KB

While creating the patch, I found there has some "magic" been done ($energy = $energy>0 ? $energy : 1). This doesn't make sense, so I've removed it. Otherwhise, zero $energy and zero $maximum would result in a popularity of 100%, which is IMHO illogical.

Please review and consider carefully.

Anonymous’s picture

Assigned: » Unassigned
tcmug’s picture

Status: Needs review » Closed (fixed)

Nice! Thanks and committed :)