mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
Embeddable: Handler null pointer exceptions for <gallery> when no de.wikipedia.org-file-core.xowa file is available
This commit is contained in:
parent
e687f23586
commit
c2dca930f3
@ -234,6 +234,7 @@ public class Swt_kit implements Gfui_kit {
|
||||
public Gfui_dlg_msg New_dlg_msg(String msg) {return new Swt_dlg_msg(shell).Init_msg_(msg);}
|
||||
public ImageAdp New_img_load(Io_url url) {
|
||||
if (url == Io_url_.Empty) return ImageAdp_.Null;
|
||||
if (!Io_mgr.Instance.Exists(url)) return ImageAdp_.Null; // must check if exists or fatal error; DATE:2017-06-02
|
||||
Image img = new Image(display, url.Raw());
|
||||
Rectangle rect = img.getBounds();
|
||||
return new Swt_img(this, img, rect.width, rect.height).Url_(url);
|
||||
|
@ -69,8 +69,10 @@ public class Swt_btn_no_border implements GxwElem, Swt_control {
|
||||
// note can't use width, b/c search_exec_btn somehow goes from 16px to 20px
|
||||
if (v.Size().Height() != size.Height())
|
||||
v = v.Resize(size.Width(), size.Height());
|
||||
if ((v.Under() instanceof Image)) { // check needed else will fail when image doesn't exist; DATE:2017-06-03
|
||||
box_btn.setImage(Copy_w_transparency((Image)v.Under()));
|
||||
}
|
||||
}
|
||||
private Image Copy_w_transparency(Image src) {
|
||||
// set transparency
|
||||
ImageData imageData = src.getImageData();
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/luaj-vm"/>
|
||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/100_core"/>
|
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/140_dbs"/>
|
||||
|
@ -35,6 +35,7 @@ public class Fsm_mnt_mgr implements Gfo_invk {
|
||||
}
|
||||
public int Mnts__len() {return mnt_ary_len;}
|
||||
public Fsm_mnt_itm Mnts__get_at(int i) {return mnt_ary[i];}
|
||||
public Fsm_mnt_itm Mnts__get_main_or_null() {return mnt_ary == null ? null : mnt_ary[Mnt_idx_main];} // NOTE: can be null for embeddable parser; DATE:2017-06-06
|
||||
public Fsm_mnt_itm Mnts__get_main() {return mnt_ary[Mnt_idx_main];}
|
||||
public Fsm_mnt_itm Mnts__get_insert() {return mnt_ary[insert_idx];} public void Mnts__get_insert_idx_(int v) {insert_idx = v;} private int insert_idx = Mnt_idx_user;
|
||||
public Fsm_bin_fil Bins__at(int mnt_id, int bin_db_id) {return mnt_ary[mnt_id].Bin_mgr().Dbs__get_by_or_null(bin_db_id);}
|
||||
|
@ -30,8 +30,8 @@ public class Xoa_app_ {
|
||||
}
|
||||
}
|
||||
public static final String Name = "xowa";
|
||||
public static final int Version_id = 527;
|
||||
public static final String Version = "4.5.5.1705";
|
||||
public static final int Version_id = 528;
|
||||
public static final String Version = "4.5.6.1706";
|
||||
public static String Build_date = "2012-12-30 00:00:00";
|
||||
public static String Build_date_fmt = "yyyy-MM-dd HH:mm:ss";
|
||||
public static String Op_sys_str;
|
||||
|
@ -111,7 +111,8 @@ public class Xow_file_mgr implements Gfo_invk {
|
||||
}
|
||||
if (this.Version() == Version_1) return new Db_cfg_hash("");
|
||||
this.Init_file_mgr_by_load(wiki); // make sure fsdb is init'd
|
||||
return fsdb_mgr.Mnt_mgr().Mnts__get_main().Cfg_mgr().Grps_get_or_load(grp);
|
||||
Fsm_mnt_itm mnt_itm = fsdb_mgr.Mnt_mgr().Mnts__get_main_or_null(); // NOTE: can be null for embeddable parser; DATE:2017-06-06
|
||||
return mnt_itm == null ? new Db_cfg_hash("") : mnt_itm.Cfg_mgr().Grps_get_or_load(grp);
|
||||
}
|
||||
public Xof_fsdb_mgr Fsdb_mgr() {return fsdb_mgr;} private Xof_fsdb_mgr fsdb_mgr = new Xof_fsdb_mgr__sql();
|
||||
public void Clear_for_tests() { // NOTE: must clear else fsdb_mode will be cached for multiple runs; will generally be v1, but some tests will set to v2; DATE:2015-12-22
|
||||
@ -146,6 +147,8 @@ public class Xow_file_mgr implements Gfo_invk {
|
||||
}
|
||||
public void Init_file_mgr_by_load(Xow_wiki wiki) {
|
||||
if (db_core != null) return; // already init'd
|
||||
if (wiki.Data__core_mgr() == null) return; // NOTE: can be null for embeddable parser; DATE:2017-06-06
|
||||
|
||||
this.db_core = Fsdb_db_mgr_.new_detect(wiki, wiki.Fsys_mgr().Root_dir(), wiki.Fsys_mgr().File_dir());
|
||||
if ( db_core == null // "-file-core.xowa" not found
|
||||
&& !wiki.Data__core_mgr().Props().Layout_file().Tid_is_all() // DATE:2015-08-10
|
||||
|
@ -388,7 +388,12 @@ public class Xog_bnd_mgr implements Gfo_invk {
|
||||
win.Show(app, app.Gui_mgr().Kit(), app.Gui_mgr().Browser_win().Win_box(), args[0], args[1], args[2]);
|
||||
}
|
||||
else {
|
||||
String[] flds = gplx.xowa.addons.apps.cfgs.enums.Xoitm_gui_binding.To_ary(m.ReadStr("v"));
|
||||
String val = m.ReadStr("v");
|
||||
if (String_.Len_eq_0(val)) { // need to check, or may fail when running newer codebase against old cfgs; DATE:2017-06-02
|
||||
Gfo_usr_dlg_.Instance.Warn_many("", "", "binding does not have val; key=~{0}", k);
|
||||
return this;
|
||||
}
|
||||
String[] flds = gplx.xowa.addons.apps.cfgs.enums.Xoitm_gui_binding.To_ary(val);
|
||||
int box = Xog_bnd_box_.Xto_sys_int(flds[0]);
|
||||
String key = String_.Replace(k, "xowa.gui.shortcuts.", "");
|
||||
Xog_bnd_itm bnd = app.Gui_mgr().Bnd_mgr().Get_or_null(key);
|
||||
|
Loading…
Reference in New Issue
Block a user