diff --git a/SOURCES/0004-text-input-crash.patch b/SOURCES/0004-text-input-crash.patch
new file mode 100644
index 0000000..91bacf1
--- /dev/null
+++ b/SOURCES/0004-text-input-crash.patch
@@ -0,0 +1,12 @@
+--- src/libnrtype/Layout-TNG-OutIter.cpp~       2018-03-11 16:38:09.000000000 -0400
++++ src/libnrtype/Layout-TNG-OutIter.cpp        2018-06-16 13:17:03.129605681 -0400
+@@ -182,6 +182,8 @@
+     if (_input_stream[source_index]->Type() != TEXT_SOURCE)
+         return iterator(this, char_index);
+
++    if (char_index >= _characters.size())
++        return end();
+     return iterator(this, char_index);
+     /* This code was never used, the text_iterator argument was "NULL" in all calling code
+     InputStreamTextSource const *text_source = static_cast<InputStreamTextSource const *>(_input_stream[source_index]);
+
diff --git a/SPECS/inkscape.spec b/SPECS/inkscape.spec
index 5458adc..ca1db2c 100644
--- a/SPECS/inkscape.spec
+++ b/SPECS/inkscape.spec
@@ -2,7 +2,7 @@
 
 Name:           inkscape
 Version:        0.92.3
-Release:        15%{?dist}
+Release:        16%{?dist}
 Summary:        Vector-based drawing program using SVG
 
 License:        GPLv2+ and CC-BY
@@ -22,6 +22,7 @@ Patch1:   0003-use-python2.patch
 Patch2:   inkscape-poppler-0.64.0.patch
 Patch3:   inkscape-poppler-0.65.0.patch
 Patch4:   inkscape-poppler-20.11.0.patch
+Patch5:        0004-text-input-crash.patch
 
 BuildRequires:  aspell-devel aspell-en
 BuildRequires:  atk-devel
@@ -141,6 +142,7 @@ rpmbuild --showrc
 %patch2 -p1 -b .poppler-0.64.0
 %patch3 -p1 -b .poppler-0.65.0
 %patch4 -p1 -b .poppler-20.11.0
+%patch5 -p0 -b .text-input-crash
 
 # https://bugs.launchpad.net/inkscape/+bug/314381
 # A couple of files have executable bits set,
@@ -333,6 +335,9 @@ grep -E -rl '^#!\s*/usr/bin/env\s+python' --include=\*.py "%{buildroot}" |
 
 
 %changelog
+* Mon Nov 08 2021 Jan Horak <jhorak@redhat.com> - 0.92.3-16
+- Fixing crashes on text input, rhbz#1997106
+
 * Thu May 13 2021 Jan Horak <jhorak@redhat.com> - 0.92.3-15
 - Added python dependency for the flatpak too