Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
yad
Commits
cbaea1a1
Commit
cbaea1a1
authored
Jul 15, 2019
by
Victor Ananjevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix segfault when opening zero-length file in text-info dialog
parent
d24e98cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
22 deletions
+25
-22
text.c
src/text.c
+25
-22
No files found.
src/text.c
View file @
cbaea1a1
...
...
@@ -375,28 +375,31 @@ fill_buffer_from_file ()
return
;
}
gtk_text_buffer_get_iter_at_offset
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
iter
,
0
);
if
(
!
g_utf8_validate
(
buf
,
-
1
,
NULL
))
{
gchar
*
utftext
=
g_convert_with_fallback
(
buf
,
-
1
,
"UTF-8"
,
"ISO-8859-1"
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
options
.
text_data
.
formatted
&&
!
options
.
common_data
.
editable
)
gtk_text_buffer_insert_markup
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
utftext
,
-
1
);
else
gtk_text_buffer_insert
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
utftext
,
-
1
);
g_free
(
utftext
);
}
else
{
if
(
options
.
text_data
.
formatted
&&
!
options
.
common_data
.
editable
)
gtk_text_buffer_insert_markup
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
buf
,
-
1
);
else
gtk_text_buffer_insert
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
buf
,
-
1
);
}
/* We had a newline in the buffer to begin with. (The buffer always contains
* a newline, so we delete to the end of the buffer to clean up.
if
(
len
<=
0
)
return
;
gtk_text_buffer_get_iter_at_offset
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
iter
,
0
);
if
(
!
g_utf8_validate
(
buf
,
-
1
,
NULL
))
{
gchar
*
utftext
=
g_convert_with_fallback
(
buf
,
-
1
,
"UTF-8"
,
"ISO-8859-1"
,
NULL
,
NULL
,
NULL
,
NULL
);
if
(
options
.
text_data
.
formatted
&&
!
options
.
common_data
.
editable
)
gtk_text_buffer_insert_markup
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
utftext
,
-
1
);
else
gtk_text_buffer_insert
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
utftext
,
-
1
);
g_free
(
utftext
);
}
else
{
if
(
options
.
text_data
.
formatted
&&
!
options
.
common_data
.
editable
)
gtk_text_buffer_insert_markup
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
buf
,
-
1
);
else
gtk_text_buffer_insert
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
,
buf
,
-
1
);
}
/* We had a newline in the buffer to begin with. (The buffer always contains
* a newline, so we delete to the end of the buffer to clean up.
*/
gtk_text_buffer_get_end_iter
(
GTK_TEXT_BUFFER
(
text_buffer
),
&
end
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment