Skip to content

Commit 86354ca

Browse files
authored
Merge branch 'main' into lenemter/fix-crash
2 parents 4569bd1 + c4f004c commit 86354ca

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/ScreenshotManager.vala

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,28 @@ public class Gala.ScreenshotManager : Object {
1515
[DBus (visible = false)]
1616
public NotificationsManager notifications_manager { get; construct; }
1717

18+
private bool? _is_redacted_font_available = null;
19+
private bool is_redacted_font_available {
20+
get {
21+
if (_is_redacted_font_available != null) {
22+
return _is_redacted_font_available;
23+
}
24+
25+
(unowned Pango.FontFamily)[] families;
26+
Pango.CairoFontMap.get_default ().list_families (out families);
27+
28+
_is_redacted_font_available = false;
29+
foreach (unowned var family in families) {
30+
if (family.get_name () == "Redacted Script") {
31+
_is_redacted_font_available = true;
32+
break;
33+
}
34+
}
35+
36+
return _is_redacted_font_available;
37+
}
38+
}
39+
1840
private Settings desktop_settings;
1941

2042
private string prev_font_regular;
@@ -316,7 +338,7 @@ public class Gala.ScreenshotManager : Object {
316338
}
317339

318340
private void unconceal_text () {
319-
if (conceal_timeout == 0) {
341+
if (!is_redacted_font_available || conceal_timeout == 0) {
320342
return;
321343
}
322344

@@ -329,6 +351,10 @@ public class Gala.ScreenshotManager : Object {
329351
}
330352

331353
public async void conceal_text () throws DBusError, IOError {
354+
if (!is_redacted_font_available) {
355+
throw new DBusError.FAILED ("Redacted font is not installed.");
356+
}
357+
332358
if (conceal_timeout > 0) {
333359
Source.remove (conceal_timeout);
334360
} else {

0 commit comments

Comments
 (0)