# django__django-16046
# Loki Mode Multi-Agent Patch
# Attempts: 1

--- a/django/utils/numberformat.py
+++ b/django/utils/numberformat.py
@@ -25,6 +25,10 @@ def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='',
     # sign
     sign = ''
     str_number = str(number)
+    # Handle empty string (e.g., from null number fields)
+    if str_number == '':
+        return str_number
+
     if str_number[0] == '-':
         sign = '-'
         str_number = str_number[1:]