1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 00:35:26 +03:00

Fix and add check for chrome.runtime.lastError

This commit is contained in:
Mark Haslinghuis 2020-12-18 22:10:25 +01:00
parent 0f8a2911d9
commit 431aa6bac8
13 changed files with 83 additions and 121 deletions

View file

@ -175,11 +175,11 @@ FONT.parseMCMFontFile = function(dataFontFile) {
FONT.openFontFile = function() {
return new Promise(function(resolve) {
chrome.fileSystem.chooseEntry({ type: 'openFile', accepts: [{ description: 'MCM files', extensions: ['mcm'] }] }, function(fileEntry) {
FONT.data.loaded_font_file = fileEntry.name;
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
if (checkChromeRuntimeError()) {
return;
}
FONT.data.loaded_font_file = fileEntry.name;
fileEntry.file(function(file) {
const reader = new FileReader();
reader.onloadend = function(e) {
@ -2970,8 +2970,7 @@ TABS.osd.initialize = function(callback) {
$(document).on('click', 'span.progressLabel a.save_font', function() {
chrome.fileSystem.chooseEntry({ type: 'saveFile', suggestedName: 'baseflight', accepts: [{ description: 'MCM files', extensions: ['mcm'] }] }, function(fileEntry) {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError.message);
if (checkChromeRuntimeError()) {
return;
}