[gitg/fix-warnings: 5/7] Control errors
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/fix-warnings: 5/7] Control errors
- Date: Tue, 15 Feb 2022 00:33:12 +0000 (UTC)
commit 7f8203f2b24156ace7de365ed9f84870454c9f1a
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Tue Feb 15 01:10:33 2022 +0100
Control errors
libgitg/gitg-diff-view.vala | 2 +-
libgitg/gitg-textconv.vala | 47 +++++++++++++++++++++++++++------------------
2 files changed, 29 insertions(+), 20 deletions(-)
---
diff --git a/libgitg/gitg-diff-view.vala b/libgitg/gitg-diff-view.vala
index 111b2643..f40bcfcb 100644
--- a/libgitg/gitg-diff-view.vala
+++ b/libgitg/gitg-diff-view.vala
@@ -598,9 +598,9 @@ public class Gitg.DiffView : Gtk.Grid
{
if (repository != null)
{
- var conf = repository.get_config().snapshot();
try
{
+ var conf = repository.get_config().snapshot();
conf.match_foreach(regex_custom_links, (match_info, value) => {
string group = match_info.fetch(1);
debug ("found custom-link group: %s", group);
diff --git a/libgitg/gitg-textconv.vala b/libgitg/gitg-textconv.vala
index b2fb8f99..7913c055 100755
--- a/libgitg/gitg-textconv.vala
+++ b/libgitg/gitg-textconv.vala
@@ -32,7 +32,11 @@ public class TextConv
{
string? command = null;
var path = file.get_path();
- var diffattr = repository.get_attribute(path, "diff",
Ggit.AttributeCheckFlags.FILE_THEN_INDEX);
+ string? diffattr = null;
+ try
+ {
+ diffattr = repository.get_attribute(path, "diff",
Ggit.AttributeCheckFlags.FILE_THEN_INDEX);
+ } catch {}
if (diffattr != null)
{
var textconv_key = "diff.%s.textconv".printf(diffattr);
@@ -55,11 +59,13 @@ public class TextConv
var oid = file.get_oid();
uint8[]? raw_content = null;
if (!oid.is_zero()) {
- var blob = repository.lookup<Ggit.Blob>(oid);
- raw_content = blob.get_raw_content();
+ try
+ {
+ var blob = repository.lookup<Ggit.Blob>(oid);
+ raw_content = blob.get_raw_content();
+ content = get_textconv_content_from_raw(repository, file,
raw_content);
+ } catch {}
}
-
- content = get_textconv_content_from_raw(repository, file, raw_content);
}
return content;
}
@@ -80,23 +86,26 @@ public class TextConv
private static uint8[] textconv(string command, uint8[]? data)
{
- var subproc = new Subprocess(STDIN_PIPE | STDOUT_PIPE, command, "/dev/stdin");
+ string lines = "";
+ try
+ {
+ var subproc = new Subprocess(STDIN_PIPE | STDOUT_PIPE, command, "/dev/stdin");
- var input = new MemoryInputStream.from_data(data, GLib.free);
+ var input = new MemoryInputStream.from_data(data, GLib.free);
- subproc.get_stdin_pipe ().splice (input, CLOSE_TARGET);
- var end_pipe = subproc.get_stdout_pipe ();
- var output = new DataInputStream (end_pipe);
+ subproc.get_stdin_pipe ().splice (input, CLOSE_TARGET);
+ var end_pipe = subproc.get_stdout_pipe ();
+ var output = new DataInputStream (end_pipe);
- string lines = "";
- string? line = null;
- do {
- line = output.read_line();
- if (line != null) {
- line = line.replace("\f", "");
- lines += line+"\n";
- }
- } while (line != null);
+ string? line = null;
+ do {
+ line = output.read_line();
+ if (line != null) {
+ line = line.replace("\f", "");
+ lines += line+"\n";
+ }
+ } while (line != null);
+ } catch {}
return lines.data;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]